Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to combine multiple rsync commands into one command. Currently I use the following command:

/usr/bin/rsync --exclude-from=/directory/exclude.txt --delete --rsync-path "/usr/bin/sudo /usr/bin/rsync" -e 'ssh' -rtogpu /directory user@server:/directory

This command is executed 5 times with different directories. I've tried to combine these 5 commands into one command using --include-from=include.txt and --files-from=include.txt like this:

/usr/bin/rsync  --delete --rsync-path "/usr/bin/sudo /usr/bin/rsync" -e 'ssh' -rtogpu --files-from=/directory/include user@server:/directory

Unfortunately this didn't do the trick, is there a good way to do this with rsync? And if so how would I be able to do that?

Just to be clear, I need to synchronize the entire content of the directories, not just single files.

Thanks in advance!

Edit

My include file is like this:

/directory/lower-dir/even-lower-dir/
/directory/lower-dir/
/directory/lower-dir/even-lower-dir/lowest-dir/

I've tried it with and without trailing slashes at the end as Roomney suggested but it didn't matter.

share|improve this question
    
Show us the include file. –  Zoredache Apr 23 '12 at 15:48
    
I've edited the OP. –  Meatje Apr 23 '12 at 16:26
    
A bit too busy this second to add an answer, but you need to look more a the Include/Exclude Pattern Rules section of the man page. To include a directory you want something like /foo/***. –  Zoredache Apr 23 '12 at 16:46

1 Answer 1

I am not sure what how exactly using --include-from=include.txt is not working for you. In your include.txt file, firstly make sure it is either in your current directory, or use an absolute path to it.

Within include.txt, make sure you have an absolute path to each folder with no trailing slash. Also, you may want to try the command without --files-from=include.txt as I'm not sure if it is required. I hope this helps a bit!

share|improve this answer
    
Hi, zoredache could be right, never got a chance to check, but your second command seems to be missing the 'include-from' argument, is that a typo? It looks like your defining the includes twice maybe (i might have misread that) –  Rqomey Apr 23 '12 at 18:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.