Kees C. Bakker
Kees C. Bakker

Reputation: 33371

How to create an exclude file entry for xcopy that matches the extension of a file name?

Consider the following batch statements:

for / %f in (C:\temp\cool\*) do if not "%~nf" == "update" 
    xcopy /r /Y /S /D:01-01-2001 /EXCLUDE:excl.txt %f c:\temp\%~nf\

It uses an file with a list of excludes. This excl.txt looks like:

.config
.log

It is supposed to skip all files log and config files. Unfortunately it is also skipping this file:

cfw.loginpopup.js

How can I fix this problem? I only like to exclude files that end in a .log.

Upvotes: 0

Views: 188

Answers (1)

Erik Dekker
Erik Dekker

Reputation: 2433

Maybe I'm thinking too simple, but you can try this for the exclusion list:

*.config 
*.log

Upvotes: 1

Related Questions