Find and clear DIR

Microsoft Windows 7 professional
February 5, 2010 at 08:43:07
Specs: Windows 7
I need to find and clear folders on my PC. I
have it set up to provide the main parent DIR,
but I want to search though each folder and if I
ever find Bin or Debug directories I want to go
into it and clear them. How would I do that? So
far all I have is:

@echo off
echo Enter full Dir WITHOUT trailing slash
set /p dirToClear=
echo Clearing Bin and Debug folders
rmdir /s /q %dirToClear%\*\Bin 2>NUL
rmdir /s /q %dirToClear%\Debug\* 2>NUL
echo All folders have been cleared

See More: Find and clear DIR

Report •

February 6, 2010 at 01:48:07
@echo off & setLocal EnableDELAYedeXpansion

set /p dirToClear=Enter full Dir WITHOUT trailing slash
if exist %dirToClear%\Bin rd /s /q %dirToClear%\Bin
if exist %dirToClear%\debug rd /s /q %dirToClear%\debug

Helping others achieve escape felicity


Report •

February 7, 2010 at 06:51:47
There's a nice command written escpecially for such questions:

for /R C:\ %%d in (debug) do echo %%d

Report •

February 8, 2010 at 05:47:10
Perfect! I was able to do exactly what I wanted with the for
command. Thanks

Report •

Related Solutions

Ask Question