Delete A Directory Folder Without Being Prompted For Confirmation Due To Readonly Files

Category VBScript Sub Category Backing Up
Bookmark and Share
This version uses the form of a bat file to delete all files in a folder without the normal windows check prompt for read only files. Very useful if you are deleting existing backup folders of previous archives and you know you want everything deleted. Saves you having to continually hit the confirm button on read only prompts.
Create a batch file such as DeleteDir.bat and add the following code. Then run by double clicking in explorer.
This will completely remove the passed in folder name without the annoying prompts if doing normal explorer delete, due to read only files.

Copy Code
@echo off REM pass in full folder path to delete echo -------------------------------------------------------------- echo - Warning this will delete everything in the folder entered! - echo -------------------------------------------------------------- echo - - echo ---------- Please enter full folder path to delete ----------- set /p Folder= if not exist %Folder%\nul goto NOWINDIR echo - - echo ------------------- Please wait deleting --------------------- rmdir /s /q %Folder% echo - - echo ---------------------- Folder Deleted! ----------------------- goto FINISH :NOWINDIR echo - - echo ---- Error Folder Does Not Exist! Deletion Did Not Occur! ---- :FINISH pause
Share the love
Bookmark and Share

Choose a SubCategory

Backing Up