1

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.

Bart
  • 111
  • 3

1 Answers1

0

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!

Rqomey
  • 1,055
  • 9
  • 25
  • 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