I have 5 txt files in my C drive, say
result_1.0.1.txt
result_1.0.1_tmp1.txt
result_1.0.1_tmp2.txt
result_1.0.1_tmp3.txt
result_1.0.1_tmp4.txt
At any point, there will be only 1 valid result txt file (in this case it is result_1.0.1.txt
), and multiple tmp files. I want to copy only the result_1.0.1.txt
using a generic XCOPY command. The version number in the file can be different each time. Earlier, only the result_<version>.txt
file used to be present, so my XCOPY command looked like this
xcopy /Y "C:\*.txt" result.txt
To exclude the 'tmp' files, XCOPY requires a filename as the argument for /EXCLUDE parameter. Instead of that, is there a way to pass a wildcard argument? Something like this -
xcopy /Y "C:\*.txt" /EXCLUDE:"*tmp*" result.txt