Oldschool CMD: deleting all files of a type with exceptions

Just some old school 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 specific name I want 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 😀

2 gedachten over “Oldschool CMD: deleting all files of a type with exceptions

    1. timdams's avatar

      Teach me mastah! (tbh powershell staat al lang op ‘to learn’ lijstje…maar dat lijstje is laaaaaang… :/ )

      Like

Plaats een reactie

search previous next tag category expand menu location phone mail time cart zoom edit close