Server Fault is a question and answer site for system and network administrators. 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 using cw-rsync under Windows 7 to copy files off my local machine every day to an rsync server running on a Linux box. It works fine, apart from the fact that I can't seem to exclude directory names properly. Right now, in my exclude file, I have:

My Documents/
My Downloads/

This works, but also has the effect of also excluding any directory called just "My" or "Documents" or "Downloads"

I've tried using inverted commas around the names, but that doesn't help. Any ideas?

share|improve this question
up vote 0 down vote accepted

In fact I've just tried this with latest cygwin rsync and you're right. Using exclude files it's not possible to exclude a folder with spaces in it's name. However it works to exclude its contents while the folder itself is still synchronized.

I've used the following for testing:

My\ Documents/*

Note the \ to escape the space. However the My Documents" folder is still created on target side but remains empty even if there is some content on source side.

I've found that (at least for Cygwin rsync) the --exclude= parameter works correctly even with spaces:

rsync [...] --exclude='My Documents'

Just excludes the complete folder.

So it looks like you've likely encountered a bug in rsync parsing on exclude files. But using the --exclude= parameter you can work around this issue - in worst case writing your own wrapper reading your exclude file and assigning an exclude parameter for each line.

share|improve this answer
Thanks - I didn't think to try it with --exclude so it looks like the workaround will be ok for me. Bit of a poo though, eh? – Gilgongo May 28 '11 at 16:35

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.