I am trying to write a simple batch file that deletes all files in a directory and its containing sub folders that DON’T match some file extensions.
Logic is like this:
GOTO directory
delete !(.avi, .mkv, .mp4)
Thought this would be simple enough but I have tried multiple times with no luck!
Just repeat the
if‘s for the extensions that you don’t want to delete.This answer will work for a few extensions, but if you have any more you would find a better answer here.