You are not logged in.
Pages: 1
I'm trying to use a FileNAMEMask in :
for %%d in ("C:\Directory\AB_20??????.PDF") do (
Only files starting with AB_20 are selected, that's ok, but files with a name longer than AB_20?????? are selected too.
Is there no way to limit the selection to the "real" length of the mask ?
Last edited by wquatan (16 Jun 2015 13:10)
Offline
The filemask also matches the short filename.
To get an appropriate answer then having the actual details of the task makes a difference.
Often there is a solution using the properties of the task itself - and this is very common when writing batch scripts.
Offline
The details of what is following the "do (" can be all sort of processing / commands / manipulations / a.s.o. upon the selected files. Don't want to restrict upon that.
Just would like to know how I can proceed to select only those files matching the exact length of the mask
Offline
This isn't pretty, but I think it'll do the very narrow thing you ask (hastily written and not tested):
for /f "usebackq tokens=*" %%a in (`dir /b "C:\Directory\AB_20??????.PDF" ^| findstr /b "AB_20......[.]PDF`) do
foxidrive is right though, the actions you are taking in the "do" might have a bearing on whether this is the best way to go about the problem.
cmd | *sh | ruby | chef
Offline
Pages: 1