0% found this document useful (0 votes)
69 views1 page

Delete Folders in Batch

This batch file deletes all files and folders from a specified directory. It first echoes a message stating it will delete all files from the given path, and uses the DEL command to delete all files in that directory with the force and quiet switches. It then echoes a message saying it will delete all subfolders, and uses a FOR loop with the RD command to recursively and quietly delete all subfolders within the given directory path. It finishes with an exit message.

Uploaded by

infombm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views1 page

Delete Folders in Batch

This batch file deletes all files and folders from a specified directory. It first echoes a message stating it will delete all files from the given path, and uses the DEL command to delete all files in that directory with the force and quiet switches. It then echoes a message saying it will delete all subfolders, and uses a FOR loop with the RD command to recursively and quietly delete all subfolders within the given directory path. It finishes with an exit message.

Uploaded by

infombm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

@ECHO OFF

Set dir=path-to-dir

Echo Deleting all files from %dir%


del %dir%\* /F /Q

Echo Deleting all folders from %dir%


for /d %%p in (%dir%\*) Do rd /Q /S "%%p"
@echo Folder deleted.

exit

You might also like