How to rsync selective subdirectories
wayned at users.sourceforge.net
Mon Aug 12 08:20:40 EST 2002
On Mon, 12 Aug 2002, Nitin Agarwal wrote:
> I want to rsync all the dates directories but only the "toid"
The easiest thing to do might be to use the -R (--relative) option, like
rsync -avR /abc/dir/*/toid host:/dest/
This will create the /abc/dir/DATE/toid dirs on the destination side.
If the "/dest/" dir begins with "/abc/dir", that part will be skipped.
If you don't like the extra subdirs, use an include file like this:
and a command like this:
rsync -avR --include-from=above-file /abc/dir/ host:/dest/
This includes everything in the base dir (by default), and only the toid
dirs in the one-level-deep subdirs. All other files are unaffected.
So, if the date dirs aren't the only thing in the base dir, you'll need
a more complicated include file, like this:
More information about the rsync