leodutra
2/4/2015 - 5:27 PM

Batch for deleting files and folders recursively on Windows.

Batch for deleting files and folders recursively on Windows.

@echo off

set foldername=%1

:: Remove files before removing their folders. It's faster
DEL /F /Q /S %foldername%\*

:: "RD" is much more fast than "RMDIR"
for /D %%i in ("%foldername%\*") do RD /S /Q "%%i"