Batch - Find string in text file and delete full line -


i use script thread accepted answer mofi. script copy folders , store them in text file exclude once copied folders on next run.

sometimes have folders called [incomplete]-different.names , not want copy folders. want folders string [incomplete]- , name behind skipped or not written in text file %currentlist% further processing.

these previous attempts far not , running script top. nice, , in advance.

try 1:

for /f "delims=" [incomplete]-%%d in ("%currentlist%") ( set str=%%d set str=!str: =! set str=!str: %%d =! echo !str!

try 2:

findstr /v /b /c:"[incomplete]-"%%d" "%currentlist%" del "%%d"

you close second attempt.

if want delete lines in %currentlist% contain string [incomplete]-, can direct output of findstr /v temp file , overwrite currentlist file.

findstr /v /c:"[incomplete]-" "%currentlist%" >tmplist.txt move /y tmplist.txt "%currentlist%" >nul 

Comments