Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exclude switch not working in XCOPY 1

Status
Not open for further replies.

weigoldk

MIS
Jan 12, 2001
249
US
I'd like to use the XCOPY command to copy files. I need to skip files with specific extensions. From the help screen, it looks like XCOPY would work.

Microsoft’s help says….
Using /exclude
List each string in a separate line in each file. If any of the listed strings match any part of the absolute path of the file to be copied, that file is then excluded from the copying process. For example, if you specify the string "\Obj\", you exclude all files underneath the Obj directory. If you specify the string ".obj", you exclude all files with the .obj extension.

I have the following
C:\exclude.txt

Contents of exclude.txt
*.zip
*.lck
*.fpc

C:\test has four files
One.lck
Two.lck
Three.lck
Yescopy.txt

C:\copytest is an empty directory

My command line
Xcopy c:\test\*.* c:\copytest /exclude:c:\exclude.txt

When I run this command, all four files from test are copied to copytest

When I get the solution, the command will go into a batch file to be scheduled to run nightly. The rest of the big job works perfectly so I don't want to re-invent the wheel and go into a new direction with this. My dad says I'm stubborn so I suppose I also want to just figure this exclude thing out.

Thanks in advance for your help.
 
Dan thank you. Wow, how obvious was that? I don't know how many times I read through that help screen and did not see my mistake.

I'm sending a million thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top