Page 1 of 1

delete files from a list

Posted: 12 Mar 2014 22:37
by Bobbo Jones
hi all, I am in need of what I believe is quite a simple .bat file.

I have a large folder with perhaps 16,000 .wav files in it. I need to delete about 4000 of them.
I have a .txt list of the exact file names that I want to delete and would like to automate this.

Can anyone recommend the best way I go about this?

cheers all thanks for your time

Re: delete files from a list

Posted: 12 Mar 2014 22:38
by Bobbo Jones
I tried to search for this, as im sure it will be already out there, but the search facility on the site needed more specifics than 'batch delete' or ' delete files from list'

Re: delete files from a list

Posted: 13 Mar 2014 03:59
by foxidrive
Give this a shot. Remove the echo keyword to enable the deletions. It will only show them on the screen atm.

Code: Select all

@echo off & for /f "delims=" %%a in (list.txt) do echo del "%%a"

Re: delete files from a list

Posted: 20 Mar 2014 17:46
by Bobbo Jones
Ah thanks heaps this works great :)