I want to clean up my binary files in my development directory. Is there a way I can recurse through the directory structure and delete all files that are in a bin directory using the Windows command line? (I am using Windows 7.)
Per Nathan, I tried to make a batch foo.bat:
@ECHO OFF
for /R %%x in (.) do call:myExistFunc %%x
GOTO:EOF
:myExistFunc
if exist %~1\.\bin call:myDeleteFunc %%~1\bin
GOTO:EOF
:myDeleteFunc
echo. Deleting files from %~1
del %~1*.* /Q
…and this worked.
Create a batch file that contains the following:
This will recursively walk through all child directories (from the current directory) and delete all files from every BIN folder. You could change the
*.*to whatever file type you’d like to delete.