Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run rsync -a --files-from=~/.rsync_file_list ~/destination and it tells me: rsync error: syntax or usage error (code 1) at options.c(1652) [client=3.0.7]. Can anyone enlighten me as to what I'm doing wrong?

The file ~/.rsync_file_list just contains a list of file names prefaced with ~/, separated by newlines (though I've also tried listing them all on the same line, with the same result).

If I run rsync -a ~/file ~/file2 ~/file3 ~/destination it works just fine. So what am I missing about the --files-from option?

share|improve this question
try sed "s#~/#/home/wolf/#g" -ie ~/.rsync_file_list – Andy Apr 12 '11 at 12:35
@Andy: Alas, same result. – Wolf Apr 12 '11 at 12:38
up vote 14 down vote accepted

Okay, I found the problem.

  1. The file containing file names has to contain only file names; no paths, relative or otherwise;
  2. After specifying --files-from=FILE, rsync requires a source directory in which to find the files listed.

So the command should be rsync -a --files-from=~/.rsync_file_list $HOME/ /destination.

.rsync_file_list should read:

file 1
file 2
file 3
share|improve this answer
Correction: File names in the given file ARE relative to the source directory, but cannot be above it (no ../). Leading slashes will be ignored, so absolute paths don't work. – Wolf Apr 12 '11 at 22:28

Using the "~" may not work inside a "files-from" file unless rsync is smart enough to recognize and translate the "~" symbol.

When you specify a "~" as part of a command in your shell's command line, it is the shell itself that converts "~" to your home directory before passing the argument along to the program. So even though you type rsync -a ~/file, what rsync "sees" is actually the resolved path, or rsync -a /home/foo/file.

See Bash Tilde Expansion for more information.

share|improve this answer

Your Answer


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.