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?


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.

  • 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 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.