I'm trying to write a batch file that would loop through a directory and delete any folder that is called "SAMPLE". Here is my code so far, any help would be greatly appreciated!
@echo off title WAIT !
Set "sourceDir=z:\FOLDERS"
IF NOT EXIST "%sourceDir%" (echo.Could not find %sourceDir%
&GoTo:done):: delete files For /F "Delims=" %%! in ('Dir "%sourceDir%\") do &
@rd "%%!" /s /q "%sourcedir%\ * \SAMPLE":done title,Done…….
echo.&pause>nul
Best Answer
You'll need to use %%d in a batch file, but that's the basic form. I've used similar constructs for cleaning up Subversion working directories to remove the .svn folders.
Edit: Fixed the syntax of the for command. I was working from memory and away from a Windows system at the time I posted. Sorry.