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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -