Question:
How do I batch delete a list of files from my pc?
80s BaTMaN
2007-07-13 03:48:31 UTC
I have a .txt list of over 1000 files in different locations on my pc. The list shows files in the format drive:\folder\filename
i would like to delete all the files in the list
Five answers:
Kevin
2007-07-16 03:15:55 UTC
You can use the "for" command in your batch file to read in each line of text from your list and delete the file.



Like this,



for /f %%i in (mylist.txt) do del "%%i"



====

"for /f" - the "/f" tells the "for" command to get its input from somewhere else.



"%%i" - is the variable that we'll be using in the commandline. Note, if you run this command from a command prompt, then only use a single "%" in the two places where we call the variable.



"in (mylist.txt)" - this is where we'll be getting the input to use. Replace "mylist.txt" with the name of your list file. If your batch file is in the same directory as your list file, then you don't need to enter the entire path to the list file.



"do del "%%i"" - this tells the "del" command to use the line of input as its argument.



I've included quotes around "%%i" in case you have any spaces in your path or filenames.



For example, "my program files\test.txt"

If we didn't use quotes, then the del command would look like,

del my programs files\test.txt

and we'd get an error, but if we use quotes, then it will properly look like



del "my program files\test.txt"



====

I hope this helped.
2007-07-13 03:53:41 UTC
You could do the following:



Start and then Search for Files and Folders.



Enter: *.txt



as the search criteria.

When it has finished searching, Edit and Select All and press the Delete key.
Ghiagirl
2007-07-13 03:55:26 UTC
Go to a dos prompt (Start, run, cmd).

Type cd drive:\folder\filename

Type del *.txt (that is del space *.txt)

Be careful that your dos prompt shows that you are on the proper drive NOT c:\winnt . . . (SMILE)

Good luck!
2007-07-13 03:52:31 UTC
ctrl + A then push delete
2007-07-15 20:27:07 UTC
use dirpro

http://www.geocities.com/lhcsoft2004/trialDirPro.zip


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...