@echo off
if {%1}=={} @echo Syntax: DelTree Folder&goto :EOF
if not exist %1 @echo Syntax: DelTree Folder – Folder %1 does not exist.&goto :EOF
pushd %1
if %ERRORLEVEL% NEQ 0 @echo Syntax: DelTree Folder – Folder %1 does not exist.&goto :EOF
del /q /f “*.*”
for /f “Tokens=*” %%i in (‘dir %1 /B /A /AD’) do rd /s /q “%%i”
popd
How do I remove all files and sub-directories from a folder, without removing the folder?
Leave a reply