Edit: # rsync -r $(find ~ -maxdepth 1 ! -name "data") SRC DEST
should be: # rsync -r $(find ~ -maxdepth 1 ! -name "data") DEST since the find result would be your SRC in this case. Sent with ProtonMail Secure Email. ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Wednesday, July 17, 2019 4:08 PM, Reid <[email protected]> wrote: > The `--exclude` option might do what you need. > > [root@fastvm-rhel-7-6-21 home_tmpdir]# ls -R > .: > file1 file2 file3 tmpdir > > ./tmpdir: > file4 file5 file6 > > [root@fastvm-rhel-7-6-21 home_tmpdir]# rsync -r --exclude=tmpdir . > /tmp/tmpdir1 > > [root@fastvm-rhel-7-6-21 home_tmpdir]# rsync -r . /tmp/tmpdir2 > > [root@fastvm-rhel-7-6-21 home_tmpdir]# ls -R /tmp/tmpdir1 > /tmp/tmpdir1: > file1 file2 file3 > > [root@fastvm-rhel-7-6-21 home_tmpdir]# ls -R /tmp/tmpdir2 > /tmp/tmpdir2: > file1 file2 file3 tmpdir > > /tmp/tmpdir2/tmpdir: > file4 file5 file6 > > However, this will also exclude any file names within the ~ directory > structure that contain the string "data". You could use the find command > instead to get all the subdirectories of ~ besides ~/data. I believe this > command will work: > > rsync -r $(find ~ -maxdepth 1 ! -name "data") SRC DEST > > ======================================================= > > Ben's exclude pattern doesn't work for me; it still pulls the data dir. > The`--exclude` option pattern-matches against the file name (and a directory > name is a file name). It doesn't seem to pattern-match against the path. > > Sent with ProtonMail Secure Email. > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > On Wednesday, July 17, 2019 3:51 PM, Rich Shepard [email protected] > wrote: > > > Copying directories from one desktop to another using rsync. The rsync man > > page shows how to specify directories and individual files, but I've not > > seen how to exclude a subdirectory. > > On the source host is a directory ~/data/. On the target host /home is on > > /dev/sda2 while data is a separate partition (/dev/sda3). > > What syntax allows me to copy all files but those in the source ~/data/ > > subdirectory to ~/ on the target host? > > TIA, > > Rich > > PLUG mailing list > > [email protected] > > http://lists.pdxlinux.org/mailman/listinfo/plug _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
