Kquick79
Kquick79

Reputation: 11

How to create a batch script that will only copy files with specific parts of the file name

I need to create a batch script that will only copy files with a certain part of the file name

Example I need to copy a file with * _*_2006 in its name

12345_12_2006_12345678.dcm

But I do not want to copy any files like the below examples

12345_13_2007_123452006.dcm

or

21355_10_2008_200654321.dcm

*_ * _2006*.dcm will not work

You will notice that in the two examples that I do not want to copy 2006 is also there but in a different location in the file name.

Upvotes: 1

Views: 45

Answers (2)

aphoria
aphoria

Reputation: 20189

This should work:

*_2006_*.dcm

Upvotes: 0

DavidC
DavidC

Reputation: 1862

*_ *_2006_*.dcm

should work so it should

Edit: or to be more restrictive:

?????_??_2006_*.dcm

Upvotes: 2

Related Questions