Oldschool CMD: deleting all files of a type with exceptions
December 2, 2013 2 Comments
Just some oldschool trickery: using the command prompt in windows (even works in dos! 🙂 ) it’s very easy to delete all the files of a certain type except those having a specifc name I wan’t to keep. Imagine I need to recursively delete all the jpg files in a folder and subfolders, except those named “folder.jpg”. The following command does this:
del /s dir *.jpg /s | find /i /v "folder.jpg"
Why I put this on my blog? Because I might need it for future reference 😀