Windows advanced file matching
findstr
can do regexes under Windows just fine. I'd try:
dir /b | findstr /i "^[0-9][0-9]*\.pdf$"
The "dir /b"
gives you the filenames only, one per line. The regex matches one or more digits followed by a period followed by your desired extension. For any extension, you could do:
dir /b | findstr "^[0-9][0-9]*\.[^\.]*$"
Obviously, if there are other cases more complicated, you can adjust the regex to suit. It doesn't have the full power of UNIX regexes but it's reasonably good.
The following command file shows how you can process each pdf file in the current directory that meets your "all-numeric" requirement.
@echo off
setlocal enableextensions enabledelayedexpansion
for /f "usebackq" %%i in (`dir /b ^| findstr /i "^[0-9][0-9]*\.PDF$"`) do (
set fspec=%%i
echo.Processing !fspec!
)
endlocal
The site http://www.robvanderwoude.com/batchfiles.php is a very good resource for CMD file magic (and many more things).
windows have provided you with an improved programming tool since win98. Its called vbscript.
Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = "c:\test"
Set objFolder = objFS.GetFolder(strFolder)
For Each strFile In objFolder.Files
strFileName = strFile.Name
strExtension = objFS.GetExtensionName(strFile)
strBase = objFS.GetBaseName(strFile)
If IsNumeric(strBase) Then 'check if numeric
WScript.Echo strBase
'continue to process file here.......
End If
Next
for more information on vbscript, read the manual