exclude option for rsync

Ryan Sawhill rsawhill+flist at gmail.com
Mon Nov 10 05:21:57 UTC 2008


>
> One little known feature of rsync is the fact that when run over a
> remote shell (such as rsh or ssh) you can give any shell command as
> the remote file list. The shell command is expanded by your remote
>
> shell before rsync is called. For example, see if you can work out
> what this does:
>
> 	rsync -avR remote:'`find /home -name "*.[ch]"`' /tmp/
>
> note that that is backquotes enclosed by quotes (some browsers don't
> show that correctly).
>
> not sure how to make this work.
>

Little-known indeed--I didn't know rsync could do that.. that's really cool.
So for a little more explanation, say you have a directory tree /database,
and you want to sync only the files that were changed in the last ten days.
You should be able to do something like the following:

rsync -av REMOTEHOST:'$(find /database -ctime -10)' /local/database/mirror
    which would be about the same as
rsync -av REMOTEHOST:'$(find /database -not -ctime +10)'
/local/database/mirror

The difference between using find's ctime and mtime options: mtime will only
change if the actual file data has changed, whereas ctime includes both file
data and metadata--permissions, ownership info, file name, etc.

Hope that helps!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20081110/cc1e70a5/attachment-0001.htm>


More information about the fedora-list mailing list