batches excluding multiple directory in xcopy

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
programchen
Posts: 10
Joined: 21 Nov 2011 23:43

batches excluding multiple directory in xcopy

#1 Post by programchen » 31 Dec 2011 03:29

my exclude.tmp is as follows:

C:\WINDOWS;c:\Program files

but when i try batch:
echo %windir%;c:\Program files>exclude.tmp

for %%a in (xls ppt ) do (
xcopy "*.%%a" "%destination%" /c /s /exclude:exclude.tmp
)

system still copy files from "program files" directory to destination, what should i do?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: batches excluding multiple directory in xcopy

#2 Post by aGerman » 31 Dec 2011 07:31

xcopy /?

Code: Select all

  /EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  Each string
               should be in a separate line in the files.  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.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.

The 2nd sentence tells you why.

Regards
aGerman

Post Reply