Include and Exclude

LuKreme kremels at kreme.com
Thu Dec 24 05:50:22 MST 2009


I thought this command would do what I wanted, but instead it doesn't transfer any files:

rsync -avh --stats --password-file=/var/rsync.passwd --include=Maildir/ --exclude=* mail::root/usr/home /backup/usr/

I want to backup ONLY the /usr/home/*/Maildir directories. I don't want any other files from any other directories to be transferred.

I can see in the man page where this is a problem:

       when using the --recursive (-r) option (which is implied by -a), every 
       subcomponent of every path is visited  from  the top down, so include/
       exclude patterns get applied recursively to each subcomponent's full 
       name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and 
       "/foo/bar" must not be excluded).

It then gives an example of including the parent directories.

Trouble is, I do not want any files in /usr/home/fred/ to be synced at all, only the files (and directories) in /usr/home/fred/Maildir/

Also, I don't necessarily know all the pathnames in /usr/home/; I don't want to have to build a manual include list every time I want to sync these folders.



-- 
MY MOM IS NOT DATING JERRY SEINFELD
	Bart chalkboard Ep. AABF06



More information about the rsync mailing list