user2396965
user2396965

Reputation:

Batch file to remove files by extension except double extension?

How can I remove files by extension except double extension? Sorry for my English. Here's an example:

C:\test\song.mp3
C:\test\song.ogg
C:\test\song.ogg.asset

End Result I need after removeing files:

C:\test\song.ogg.asset

Upvotes: 0

Views: 145

Answers (1)

mbarnettjones
mbarnettjones

Reputation: 131

This is quite simple to do if you jump over to Windows cmd. The lines below will remove all files with the extension .mp3 and .ogg while maintaining .ogg.asset.

(The * is a wildcard and will match any string before .mp3 / .ogg. The same is true of Bash).

del *.mp3
del *.ogg

You could use the above lines in a batch file and just run in the dir where you want to remove files. Of course there is likely more exciting ways of doing this...

Upvotes: 2

Related Questions