I've been trying to figure this out for some time now, and I have been searching the web immensely, but I couldn't find the right answer just yet. So here's my problem:
I want to create a batch file, that searches through all subfolders of a certain directory, finds a specific file and then deletes everything but that file in the folder that the searched file was in.
What I came up with so far is this:
cmd /k for /f %%a IN ('dir /b /s Neuer') do if not [%%a] == [index.txt] del /q %%a
But that deletes just every file in every subfolder - not quite what I want.
Can anyone help?
Aucun commentaire:
Enregistrer un commentaire