rodrigosantosbr

[Windows] Drop folder content

Dec 27th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

clear_dir.bat

:: This script deletes all contents of a folder.
:: This version also does not delete the root folder itself. 
@ECHO OFF
SET FOLDER=C:\Users\Administrator\syncState
if [%FOLDER%]==[] EXIT
:: Delete all files in a folder
DEL /F/Q/S "%FOLDER%" > NUL
:: Delete all subfolders
:: repeat because RD is sometimes buggy
:: Newer versions of Windows do not have DELTREE command
For /d %%G in (%FOLDER%\*) do RD /s /q "%%G"
EXIT
Add Comment
Please, Sign In to add comment