Fourhundred Thecat
2023-Aug-04 02:27 UTC
print only first level directory name when copying files
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,
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. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: https://sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
Perry Hutchison
2023-Aug-04 02:49 UTC
print only first level directory name when copying files
Fourhundred Thecat via rsync <400thecat at lists.samba.org> wrote:> 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/Do you need this reported in real time (e.g. to monitor progress), or just as a logfile? If the latter, filtering the output with grep might work -- something like this (untested): rsync --info=name1,del2 -rl /mnt/foo /mnt/bar/ | egrep '^/.*/.*/.*/$'