To delete everything inside a folder using a batch file you can use the following snippet.
It will delete all files AND folders!

Sample BAT

set folder="C:\Users\Codesnippets\Desktop\Testfolder"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)

One thought on “How to delete everything inside a folder using a batch file”

Leave a Reply