@Echo off goto :MAIN :DeleteAll pushd %1 attrib -r -h *.* > nul for /f "tokens=*" %%i in ('dir /b/ad') do rd /s/q "%%i" del *.* /q popd %1 goto :eof :USAGE echo Deletes ALL files and folders under the directory entered. echo. echo DelAll ^[drive:^]directory ^[/Y^] echo. echo ^[drive:^]directory echo Directory to be cleaned. This directory will _not_ be deleted. echo. echo ^/Y Turns off confirmation before deleting. echo. echo DelAll is a potentially destructive utility. Use with caution! goto :eof :MAIN if {%1}=={} (goto :USAGE) else if not exist "%~f1\." (goto :USAGE) else if {%2}=={/y} (goto :DeleteAll %~f1) echo Are you sure you want to delete all the files and folders in directory choice "%~f1" if %ERRORLEVEL%==1 goto :DeleteAll "%~f1" echo Aborted.