Fix Can't Delete Folder: 7 Ways That Work
In this article
If you can't delete a folder, the cause is almost always a file inside it that's locked by a running program, a permission issue, or a path that's too long. The fix is to find what's holding the folder, close it, and then delete. Below are seven methods that work on Windows 11, Windows 10, and macOS, ordered from quickest to most thorough.
What You'll Need
- Administrator account on your computer (for some steps)
- Patience – don't force-delete with third-party tools unless you've tried the safe methods first
Step-by-Step
- Close any program that might be using the folder. Look for open file explorers, text editors, image viewers, or media players that might have a file from that folder open. If you're not sure, restart your computer – this releases all file locks. After restart, try deleting again.
- Check if the folder is in use by a background process. Press Ctrl+Shift+Esc to open Task Manager (Windows). Look under "Processes" for any app that might be using the folder – like a cloud sync client (OneDrive, Dropbox), an antivirus scanner, or a media server. Right-click and select "End Task" for any suspicious process, then try deleting.
- Use the built-in "take ownership" method (Windows). Right-click the folder, select Properties → Security tab → Advanced. At the top, next to "Owner," click Change. Type your username (or "Administrators") and click Check Names → OK. Tick "Replace owner on subcontainers and objects" and click OK. Then close all dialog boxes and try deleting again.
- Use Command Prompt to force delete (Windows). Open Start, type cmd, right-click "Command Prompt" and select "Run as administrator." Then type the following and press Enter:
del /f /q "C:\path\to\folder\*.*"
Then type:rmdir "C:\path\to\folder"
Replace the path with your actual folder location. This removes read-only files and the folder itself. - For macOS: use Terminal. Open Terminal (Finder → Applications → Utilities). Type
rm -rffollowed by a space, then drag the folder into the Terminal window to insert its path. Press Enter. You'll be asked for your password. Warning: This permanently deletes the folder and its contents with no Trash, so double-check the path. - Check for long path names (Windows). If the folder is deeply nested or has very long file names, Windows may refuse to delete it. Move the folder to the root of your drive (e.g.,
C:\) using drag-and-drop, then try deleting. If that fails, rename the folder to a short name like "a" and try again. - Restart in Safe Mode and delete. If nothing else works, boot into Safe Mode (Windows: hold Shift while clicking Restart; macOS: restart and hold Command+R). In Safe Mode, many background processes are disabled, so you can delete the folder normally. After deleting, restart normally.
Common Mistakes
- Using third-party "unlocker" tools without trying safe methods first. These tools can sometimes cause system instability. Stick to the built-in methods above.
- Ignoring the Recycle Bin. If you deleted the folder but it's still visible, check the Recycle Bin – it may be waiting for permanent deletion.
- Deleting the wrong folder. Always double-check the path, especially when using Command Prompt or Terminal.
- Assuming it's a virus. A folder that can't be deleted is rarely malware. Malware usually hides in system folders, not user folders.
Tips
- Try moving the folder first. If you can move it to another location, the lock might be on a specific file. Move, then delete.
- Use the "Shift+Delete" shortcut. On Windows, selecting the folder and pressing Shift+Delete permanently deletes it without sending to Recycle Bin – but only if the folder isn't locked.
- Check for cloud sync conflicts. If the folder is inside OneDrive, Dropbox, or Google Drive, pause sync temporarily (right-click the cloud icon in the system tray) and then delete.
- For macOS, use the "Option" key. Holding Option while right-clicking the folder gives you "Delete Immediately" which bypasses Trash.
Troubleshooting
If the folder still won't delete after trying all the above, here's what to try next:
- Check for hidden files. Some files might be hidden. In Windows, open the folder, go to View → tick "Hidden items." In macOS, press Command+Shift+. (period) to show hidden files. If you see any, delete them individually first.
- Check if the folder is a system folder. If the folder is in Program Files or Windows, it might be protected. Don't force-delete system folders – you could break Windows.
- Run a disk check. Corrupted file system entries can cause deletion errors. In Windows, open Command Prompt as administrator and type
chkdsk /f(you may need to restart). On macOS, use Disk Utility → First Aid. - If you still can't delete, create a new user account. Log into a fresh administrator account and try deleting from there. This works if the folder is locked by your user profile.
Frequently Asked Questions
Why does Windows say "The action can't be completed because the folder is open in another program"?
That means a program has a handle on a file inside the folder. Close all open programs, especially file explorers, and try again. If the message persists, restart your computer.
Can I delete a folder that's in use by a system process?
Usually not safely. If the folder is in Program Files or Windows, it's likely a system folder. Don't force-delete it. If it's a user folder, try the Safe Mode method.
Is it safe to use Command Prompt to delete a folder?
Yes, if you use the correct path and understand that it permanently deletes the folder. Always double-check the path before pressing Enter.
Why can't I delete a folder on my external hard drive?
The drive might be write-protected, or the folder might be locked by the drive's file system. Check if the drive has a physical write-protect switch, and run a disk check on the drive.
What does "You need permission to perform this action" mean?
It means your account doesn't have the necessary permissions. Take ownership as described in Step 3, or log in as an administrator.
Will deleting a folder with Command Prompt send it to the Recycle Bin?
No. The rmdir command permanently deletes the folder. Use it only when you're sure you don't need the contents.