using "del" to delete a list of filenames in a text file?

Don
Joined
21 Oct 2002
Posts
46,808
Location
Parts Unknown
ok, i've got the folder..

C:\test\

in there it has
1.txt
2.txt
3.txt
4.txt
5.txt
~
1000.txt

some contain the word 'bledd' and I want to delete them.


i've used findstr like this..

findstr /I /S /M bledd *.* >c:\output.txt

that created output.txt, and in that file it says..

Code:
1.txt
5.txt
680.txt
999.txt


in the same bat file, how can I get it to delete all the files listed in output.txt?


my 'ghetto' way of pasting the contents into column b in excel, then filling a with del /q and pasting it all back into notepad just won't do this time :p
 
Last edited:
thanks guys, my commandline 'knowledge' has stemed from 7za.exe and robocopy.exe, the rest i just botch together

really need to spend some time on ss64.com

can i ask, when using for

what's the difference between..

/F
/D
/R
/L
?


edit
so what i want is..

for /f %a in (output.txt) do del /Q %a

-edit2, yup that worked
 
Last edited:
Click search button while in the folder containing the files, enter you search phrase in 'A word or phrase in the file:'. Now click search, when search is finished CTRL+A then hit delete, job done...

I should've said, it's thousands of files, explorer can't open it

sorted now
 
Back
Top Bottom