I'm attempting to back some stuff up from a server that runs an old version of rsync - for various reasons I can't just upgrade the software.

Usually, I'd use --files-from and give a list of files and directories to back up, but this version of rsync doesn't have that switch. Is there a way, with other switches, to make an older rsync behave the same way?

I've tried a combination of --include-from= --exclude=* but that looks to be insufficiently recursive (eg. /etc/* only backs up things directly below /etc).

3 Answers 3


I suspect that xargs is your friend in this instance.

Completely untested:

 # cat file | xargs -IREPLACE rsync -v REPLACE server:/path

xargs will take data from stdin and add it to the commandline one parameter per input line until it fills the command line length, and then runs a separate command until all the input lines have been used up. This will mean that rsync could well run more than once. This shouldn't be a problem in this case, but could be with other commands.

Usually xargs just sticks the arguments on the end of the line, but with rsync you'd want to have the destination last, so we use the -I option to replace a string with the arguments. (This is the bit that's untested). I'm also a little unsure what rsync will do with the paths, so please test this carefully before using it in anger.

If you do have a problem with xargs, you could use something like:

for i in $(cat file); do rsync -v $i server:/path; done

If your file is larger, you probably want to use a while/read loop instead. This will be much slower as it will do a single file at a time.

  • It would be a problem if the rsync runs more than once, since some files will be copied that are meant to be excluded. Jul 21, 2009 at 10:37
  • Only if the list of files overlap with each other, i.e. if you had a directory and a list of files in that directory. Jul 21, 2009 at 11:25

If your includes/excludes aren't recursing, perhaps you haven't specified -r? If you're used to using --files-from then you might have gotten out of the habit.

Apart from that, giving the exact command you're using might help. include-from/exclude-from definitely recurse nicely for me.


Silly no nonsense solution I've had to use before on some servers when rsync alone doesn't want to place nice. Use tar to only grab files you want:


for file in `cat INCLUDES`; do tar -r --file=INCLUDES.tar $file; done

rsync -avzP INCLUDES.tar user@remoteHost.com:./remote_path

--- Now on remote server

rsync -avzP INCLUDES/home/user/ /home/user/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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