Re: print only first level directory name when copying files

2023-08-04 Thread Kevin Korb via rsync
find /mnt/foo/* -maxdepth 0 -print -exec rsync -an `realpath {}` 
/mnt/bar/ \;

 (realpath eliminates the trailing slashes)

On 8/3/23 22:27, Fourhundred Thecat via rsync wrote:

Hello,

I am copying /mnt/foo to /mnt/bar/

   rsync --info=name1,del2 -rl /mnt/foo /mnt/bar/

/mnt/foo contains deep directory structure, ie:

   /mnt/foo/aaa/
   /mnt/foo/aaa/somestuff/
   /mnt/foo/aaa/somestuff/file1

   /mnt/foo/bbb/
   /mnt/foo/bbb/someotherstuff/
   /mnt/foo/bbb/someotherstuff/file2

I am not interested in details which individual files were copied, just
the main directory. Is it somehow possible for rsync to only report the
first level directory?

ie, to have output like this when copying:

   /mnt/foo/aaa/
   /mnt/foo/bbb/


thanks,



--
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
Kevin Korb  Phone:(407) 252-6853
Systems Administrator   Internet:
FutureQuest, Inc.   ke...@futurequest.net  (work)
Orlando, Floridak...@sanitarium.net (personal)
Web page:   https://sanitarium.net/
PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: print only first level directory name when copying files

2023-08-04 Thread Fourhundred Thecat via rsync

> On 2023-08-04 06:13, Perry Hutchison wrote:

Perry Hutchison via rsync  wrote:

On second thought, that grep will match any directory name having 3
*or more* levels.  This:

   rsync --info=name1,del2 -rl /mnt/foo /mnt/bar/ | egrep 
'^/[^/]*/[^/]*/[^/]*/$'

should match only those with exactly 3 levels.


I think that should work!

thank you

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html