mercredi 25 février 2015

Delete all subdirectories in a directory except for one

I'm trying to delete all subdirectories within %path% except for the subdirectory foobar, using a batch file:



for /D %%d in ("%path%\*") do if NOT "%%d" == "foobar" rd /S /Q "%%d"


However, all subdirectories in %path% are being deleted, including foobar.

What can be happening?


Aucun commentaire:

Enregistrer un commentaire