How to Instantly Delete Large Files and Folders on Windows

Deleting most files or folders on Windows is as easy as selecting what you want to delete and clicking the Delete button. However, when dealing with large files or folders, it could take a long time to perform the deletion. In this post, we’ll discuss the best way to instantly delete large files and folders.

Good to know: alternatively, check out how you can view large files on Windows without lag.

Why Does It Take So Long to Delete Large Files or Folders?

When wanting to delete a sizeable file or folder of 10GB or more, Windows can take up to ten minutes to perform the deletion, especially on HDDs. That’s because Windows performs some steps in the background first, including counting the number of files, identifying their types, and more.

How to Instantly Delete Large Files or Folders using Command

To instantly delete large files or folders, we’ll need to instruct Windows to skip the pre-deletion steps. Although it sounds like an unsafe action, it’s really not! Windows has a built-in command that can perform this action.

This method relies on a Command Prompt command, and since it’s impractical to run it every time you need to instantly delete something, we’ll create a batch file (BAT) that performs the command on demand.

Note: when you delete a file or folder this way, it gets permanently deleted and will not be sent to the Recycle Bin.

  1. Type “notepad” in Windows Search to open the Notepad app.
Typing notepad in Windows Search.
  1. Copy the following command to the text file:
del /f/s/q %1 > nul<br>rmdir /s/q %1
Copy pasting commands in Notepad.
  1. Click “File -> Save As.” Select the drive or folder that has the file you want to delete stored in it. Name the file as you like. Most importantly, at the end of the file name, delete the .TXT extension and add .BAT to save it as a BAT executable file.
Saving .TXT file as .BAT in Notepad.
  1. Now, when you need to instantly delete a large file or folder (you can also use it to delete small ones), drag and drop it over the BAT file, and it’ll launch the command and instantly delete it (without confirmation, so be careful).
Drag and dropping folder over .BAT file to delete it.

Tip: check our list of best context editors for Windows.

If you’re uncomfortable using the BAT file method, you can create a context menu option that does the same thing via the Registry Editor. Let’s see how.

  1. Launch Notepad.
  2. Copy and paste the following code.
@ECHO OFF
ECHO Delete Folder: %CD%?
PAUSE
SET FOLDER=%CD%
CD /
DEL /F/Q/S "%FOLDER%" > NUL
RMDIR /Q/S "%FOLDER%"
EXIT
  1. Click “File ->Save As” and save the file as “instant_delete.bat.” Make sure you’re saving it in the “C:\Windows” folder since it needs to be on the system partition.

Note: If Windows refuses to save the file in the “C:\Windows” folder due to restrictions, save it on the desktop and manually move it there.

Saving newly created file to Windows folder on C:
  1. Press Win + R and type regedit to open the Registry Editor.
Typing "regedit" in Run window.
  1. Navigate to the following path manually or copy and paste it into the path field.
Computer\HKEY_CLASSES_ROOT\Directory\shell\
Navigate to location in Registry Editor.
  1. Right-click the “shell” key on the left and select “New -> Key.”
Right-clicking "shell" key in Registry Editor.
  1. Name the newly created key “Instant Delete” or any other name you like. The name you choose will appear in the context menu. Press Enter to save the name.
New key visible in Registry Editor.
  1. Right-click the new key and select “New → Key” to create a sub-key. Name it “command” (or anything else) and press Enter to save.
  1. On the right, double-click the “Default” key and paste the following code.
cmd /c "cd %1 && instant_delete.bat"
Editing string value in Registry Editor.
  1. Close the Registry Editor and restart your PC.
  2. Upon your return to the Windows environment, you should see the option “Instant Delete” when you right-click the large file or folder you wish to delete.
  3. Clicking it will open the CMD. Press any key to confirm that you wish to delete the file or folder. Note that the deletion is also permanent.
"Instant delete" option view in context menu in Windows.

FYI: check out more registry hacks for a more optimized Windows experience.

Fixing the “You Don’t Currently Have Permission to Access This Folder” Error

Sometimes users might see the error “You don’t currently have permission to access this folder” when trying to delete files and folders large or small. The easiest way to delete these files and folders is to take ownership of them. Our post also includes additional solutions to dealing with this error, in case taking ownership does not work for you.

Fixing the “File Is Open in Another Program” Error

Sometimes the deletion process fails because the file or folder is opened or accessed by another problem. Although there are several fixes to the “File Is Open in Another Program” error, the easiest way to deal with it is by using Microsoft’s PowerToys utility.

PowerToys is an app that allows Windows users to access extra features that are not built into Windows. Microsoft developed it based on the contributions of developers around the globe.

  1. Download and install PowerToys.
  2. Launch the app and activate the “File Locksmith” feature.
Clicking on "File Locksmith" option in PowerToys app.
  1. Navigate back to the file or folder that shows the error and right-click it, then select the “What’s Using This File?” option.
Clicking on "What's using this file" option from the context menu.
  1. A pop-up window will let you know what app is using this file or folder. If there are results, click “End Task.” If there aren’t, click the refresh icon in the top-right corner to use administrator privileges to check again.
Pressing "Refresh" button under File Locksmith in PowerToys.
  1. After you click the “End Task” button, you can immediately delete the file or folder using the methods outlined earlier.
Clicking "End task" button in PowerToys.

Tip: can’t acess your Task Manager because it has been disabled by an administrator? Check our list of fixes and solve the issue.

Frequently Asked Questions

What happens when I delete a file in Windows?

When you press Delete when selecting a file or folder, it gets moved to the Recycle Bin so you can restore it later. However, when pressing Shift + Delete, the files get permanently deleted. Still, there are methods to help you restore them.

What happens when I delete a file on a flash drive?

When you delete a file on a flash drive or an external hard disk, it gets permanently deleted. Still, you can add a Recycle Bin to the flash drive to prevent losing important files by mistake.

How can I permanently delete a file on Windows?

Image credit: Flaticon & Pixabay. All screenshots by Mustafa Ashour.

Mustafa Ashour
Mustafa Ashour

Mustafa is a tech content writer who’s a geek at heart. His passion lies in writing about technology, especially software-related topics. He’s also interested in digital marketing, business development, and entrepreneurship. He holds a Bachelor’s degree in Accounting and Finance.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Leave a Reply

Your email address will not be published. Required fields are marked *