Normally, Windows ignores case, but preserves it. If your filenames change case, it must be due to some program other than rsync which copied files and mangled the case during the copy. That program is probably misconfigured. Or if you use a Samba server, maybe that is misconfigured. By default, Samba also preserves the case of filenames.
So, maybe you can solve the problem of filenames unexpectedly changing their case.
Then you are left with "only" the problem of case-sensitivity of filters. If that ends up being your case, and you are reluctant to apply the patch suggested by Wim, you can use character classes in the filters.
It's ugly and annoying, but it works:
--exclude="[Tt][Ee][Mm][Pp]/"
or in a filter file:
- Temp/
- temp/
- TEMP/
or the more generic but unreadable:
- [Tt][Ee][Mm][Pp]/
If you want to automate the conversion of filter files to this syntax, you can use this perl command:
perl -i.bak -pe 's/([a-z])/[\U$1\E$1]/g' your_rsync-filter.txt
And convert it back to human-readable form with
perl -i.bak -pe 's/ \[ [A-Z] ([a-z]) \] /$1/xg' your_rsync-filter.txt
(The -i.bak
option makes a backup and converts the file in-place instead of to stdout)
At least for filters and include/exclude options, it would be really nice to have a case-insensitive flag in rsync. Until then, the only options seem to be either the patch or the convoluted regex-like syntax.