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 have a file that rsync uses as --files-from:


I want to be able to put comments above each dir entry like that:

# my dir1 comment

#dir2 comment

#yet another comment

but rsync complains "No such file or directory"

So far I have tried #,//,--,,SPACE

Is there a way to comment out/disable entries?

share|improve this question
I am not aware of any commenting mechanism for the files-from file. – jw013 Dec 14 '12 at 17:49

Do a grep -v '^#' file > /tmp/filetmp and then launch your rsync on /tmp/filetmp

Depending on your shell, you may be able to avoid the temporary file (this is valid in Bash):

rsync --files-from <(grep -v '^#' file) …

The weird-looking <( … ) syntax is what Bash calls process substitution.

share|improve this answer
I added the pattern to your grep for you—I assume this is what you meant... I'm going to add in a bash trick as well, feel free to revert one or both edits if you disagree. – derobert Dec 14 '12 at 18:32
Thanks to add your solution I like it !! +1 – Dom Dec 15 '12 at 11:37

According to the man page on rsync:

"...Blank lines in FILE and lines starting with ’;’ or ’#’ are ignored..."

I just ran a quick test and indeed # and ; lines are ignored.

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.