rsync filtering

Posted by biomed on Super User See other posts from Super User or by biomed
Published on 2011-01-05T17:59:48Z Indexed on 2011/01/05 18:56 UTC
Read the original article Hit count: 162

Filed under:
|

I use an rsync command to sync two directories remote >local

the command is (used in python script)

os.system('rsync --verbose --progress --stats --recursive\
          --copy-links --times --include="*/" --include="*good_name*.good_ext*"\
          --exclude-from "/myhome/mydir/src/rsync.exclude"\
          %s %s'%(remotepath,localpath))

I want to exclude certain directories that has the same files that I also want to include.

I want to include recursively any_dir_name/any_file_name.good

but I want to exclude any and all files that are in

bad_dir_name/

I used exclude-from and here is my exclude from file * /*.bad_dir_name/

Unfortunately it doesn't work. I suspect it may have something to do with --include="*/" but if I remove it the command doesn't sync any files at all.

Thanks for the help.

© Super User or respective owner

Related posts about unix

Related posts about rsync