delete files from a list

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Bobbo Jones
Posts: 48
Joined: 18 Oct 2012 21:27

delete files from a list

#1 Post by Bobbo Jones » 12 Mar 2014 22:37

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

Bobbo Jones
Posts: 48
Joined: 18 Oct 2012 21:27

Re: delete files from a list

#2 Post by Bobbo Jones » 12 Mar 2014 22:38

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'

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: delete files from a list

#3 Post by foxidrive » 13 Mar 2014 03:59

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"

Bobbo Jones
Posts: 48
Joined: 18 Oct 2012 21:27

Re: delete files from a list

#4 Post by Bobbo Jones » 20 Mar 2014 17:46

Ah thanks heaps this works great :)

Post Reply