|
Answer» DOS supports the use of wildcards using a ? [question mark]. I have files of all different names, but I am looking for files that meet a specific criteria:
I have files of the names: somename.csv abc2ee.csv file344.csv debt32.csv .... somename1108112.csv << i want this >> abc2ee1108112.csv << i want this >> file3440822451.csv << i want this >> debt321008213.csv << i want this >> ....
The number PART of the above files can be any number, is there a way to replace something like
Code: [Select]somename???????.csv, that is, insteading of typing so many question marks like use some multiplier?
While I am on the subject, how can I say give me EVERY file which is preceeded only by7 digits before the ".csv"?
THANKS....dir somename*.csv --> lists any file starting with somename and with csv extension
Regarding last question, i don't remember well, but i think you cannot combine both wildcards ("?" and "*") in the same expression. So [i think] you can search for a file with exactly n digits, but not at least n digits. I mean, you can do
dir .csv --> will list any 3-digit filename with csv extension
but you can't do
dir *.csv --> Error. Cannot combine both wildcards.
In case anyone is interested, here is what I have DONE to resolve my issue:
REM Perform a "dir" on the SOURCE_PATH, and then save a list of all files which REM have the extension ".csv" preceeded by 6 digits. REM dir /B %%SOURCE_PATH%% | findstr ".*[0-9][0-9][0-9][0-9][0-9][0-9]\.csv" > tmp.txt ........
|