Xcopy /exclude does not exclude some of the specified criteria
Posted
by
Richard Z.
on Super User
See other posts from Super User
or by Richard Z.
Published on 2012-03-30T17:15:17Z
Indexed on
2012/03/30
17:33 UTC
Read the original article
Hit count: 460
Good afternoon.
I want xcopy to copy all files meeting a certain criteria located in the C drive to a specific folder, except ones located in the directories specified in excl.txt. The exclusions only work partially - the files located in %systemroot%, %programfiles% and in each profile's appdata are still copied, even though those directories are listed in excl.txt.
How do I make xcopy skip those directories, preferentially still using environment vars to specify the paths?
My current syntax is:
xcopy /s /c /d /h /i /r /y /g /f /EXCLUDE:excl.txt %systemdrive%\*.doc f:\test\
excl.txt currently contains the following:
\%temp%\
\%userprofile%\appdata
\%programfiles%\
\%programfiles(x86)%\
\%systemroot%\
\%programdata%\
appdata
windows
%programfiles%
Thank you very much.
© Super User or respective owner