What I mean is to find files of a specified type.
I don't know much about BAT. After reading BAT for a few days, I just wrote the following bit.
But I found that under pure DOS, FOR /F and such can't be used... Please experts come up with a solution.
I don't know much about BAT. After reading BAT for a few days, I just wrote the following bit.
But I found that under pure DOS, FOR /F and such can't be used... Please experts come up with a solution.
@ECHO OFF & SETLOCAL ENABLEDELAYEDEXPANSION
::::::::::::::::::::::::::::::::::::::::::
::Suffix type definition, ","
SET FileTypes=*.gh0,*.sys,*.gho,*.max,*.bak
::Number of types
SET TypeCount=5
::::::::::::::::::::::::::::::::::::::::::
::Each type is defined to be 5 characters long
SET /A COUNT=(%TypeCount%)*5
::Get each extension and compare with dir result
FOR /F "usebackq skip=5 tokens=3,* delims= " %%a IN (`dir /a-D !FileTypes!`) DO (
::ECHO %%a----%%b----*%%~xb
FOR /L %%i IN (0 6 %Count%) DO (
IF "*%%~xb"=="!FileTypes:~%%i,5!" (ECHO Found file "%%b".)
)
)
:TOGHOST
PAUSE
