cmd - Want to exclude specific files with dir findstr -
i want find *.csv files within folder-structure except 2 files
this code
for /f "tokens=*" %%i in ('dir /b /s *.csv | findstr /v /i "\combinedold.csv" | findstr /v /i "\combined.csv"')
the 2 files "combined.csv" , "combinedold.csv".
the basic command should
dir /s /b /a-d *.csv | findstr /v /i /e /c:"\\combinedold.csv" /c:"\\combined.csv"
now, include inside for /f
command, necessary escape non quoted special characters (the pipe in case), becomes
for /f "delims=" %%i in (' dir /s /b /a-d *.csv ^| findstr /v /i /e /c:"\\combinedold.csv" /c:"\\combined.csv" ') echo %%i
Comments
Post a Comment