for loop - How to find all files that don't contain a string? -
i've found following code on site:
@echo off setlocal set "rootfolder=c:\yourrootpath" set "filemask=*.txt" set "outfile=missing.txt" >"%outfile%" ( /d %%d in ("%rootfolder%") %%f in ("%%d\%filemask%") ( findstr /nbr "$o..*\.min%%" "%%f" | findstr /bl "1:" >nul || echo %%f ) )
however, when run batch file, receive following error: "for unexpected @ time."
my research says caused not using double %%
, not case. guess simple, can't work out, tips please?
this method should run faster:
@echo off setlocal set "rootfolder=c:\yourrootpath" set "filemask=*.txt" set "outfile=%~p0missing.txt" cd "%rootfolder%" findstr /s /m /b /r "$o..*\.min%%" "%filemask%" > temp.tmp ( dir /s /a-d /b "%filemask%" | findstr /v /g:temp.tmp ) > "%outfile%" del temp.tmp
the missing.txt
file stored in same folder of batch file, must not in folder of search files!
Comments
Post a Comment