I have seen Deleting all files that do not match a certain pattern – Windows command line
However, I have not seen anything regarding how to delete everything that does not contain a certain string within its file name.
How can I delete all zip (other files should not be effected) files in a folder and its subfolders that don't have "MS" (case sensitive) in their file name.
These letters may be next to other letters (eg. a file names "ABCMSABC" should be kept because it has "MS" in it, but all other files should be deleted). Multiple files will have "MS" in them.
Best Answer
How can I delete zip files in a folder/subfolders that don't have "MS" in their name?
Use the following batch file:
Notes:
echo
when you are happy with what the batch file will do.Further Reading