Some things of note about xcopy:- In reply to 'student', /EXCLUDE does not support filenames with spaces, in any form. I've tried quoting them singly, doubly, quoting the whole argument, etc. -- the only way I've found to use an exclude file with spaces in its pathname is to use the old 8.3 name for it:
won't work: /EXCLUDE:"C:\Documents and Settings\Me\exclude.txt"
works: /EXCLUDE:C:\Docume~1\Me\exclude.txt
- As alluded to by Dr. Nick, xcopy's /? documentation is wrong when it says:
/EXCLUDE:file1[+file2][+file3]...
... When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. ...
It should probably say *relative* path, because that's what happens. For example, suppose my exclusions file contains the line
C:\Documents and Settings\Me\Start Menu
and I invoke xcopy from "C:\Documents and Settings\Me\" with a source argument of "*". xcopy will copy the Start Menu folder because "C:\Documents and Settings\Me\Start Menu" is not a substring of "Start Menu\".
However, if I were to invoke xcopy with a source argument of "C:\Documents and Settings\Me", xcopy uses the full absolute paths to match against my exclusion list, and now indeed "C:\Documents and Settings\Me\Start Menu" is a substring of "C:\Documents and Settings\Me\Start Menu".
- (not really related to this post, but whatever) When using the /m option (copy only files with Archive, then clear Archive), xcopy does not clear the archive bits until after *all* files are done copying. This can be handy, e.g. you're in the middle of a backup and you notice your exclusions file isn't working.