Cannot Delete Files From USB? Fixes That Work
In this article
- Why Can’t You Delete Files From a USB Drive?
- Check for a Physical Write-Protect Switch
- Remove Write Protection in Windows
- Close Programs That Are Using the File
- Run Error Checking on the USB Drive
- Use Safe Mode or Command Prompt to Delete Stubborn Files
- Reformat the USB Drive as a Last Resort
- Frequently Asked Questions
If you cannot delete files from a USB drive, the cause is almost always one of three things: the drive is write-protected, a file is in use by a program, or the drive has file system errors. This article explains each cause and gives step-by-step fixes for Windows, macOS, and common USB issues.
Why Can’t You Delete Files From a USB Drive?
USB drives store data on flash memory, and the file system (usually FAT32, exFAT, or NTFS) controls how files are named, stored, and removed. When you delete a file, the system marks that space as available rather than physically erasing it. If the drive refuses to delete, the problem is typically one of the following:
- Write protection: A physical switch on the drive or a software flag that makes the drive read-only.
- File in use: Another program (like a media player or antivirus) has the file open, locking it.
- File system corruption: Errors in the file system that prevent normal operations.
- Permission issues: The file is marked as read-only, or your user account lacks write access.
- Malware or third-party software: Some programs can lock files or interfere with deletion.
Check for a Physical Write-Protect Switch
Many USB flash drives have a small switch on the side that toggles write protection. If the switch is in the "lock" position, the drive becomes read-only, and you cannot delete, add, or modify files. Look for a tiny slider, often labeled with a lock icon. Move it to the unlocked position and try again. If there is no switch, the drive may have been set to read-only in software.
Remove Write Protection in Windows
Windows can enforce write protection through the registry or the diskpart command. Here is how to clear it:
- Press Win + R, type
cmd, and press Enter to open Command Prompt. - Type
diskpartand press Enter. If prompted by User Account Control, click Yes. - Type
list diskand press Enter to see all disks. Note the disk number of your USB drive (usually Disk 1 or higher). - Type
select disk X(replace X with your drive number) and press Enter. - Type
attributes disk clear readonlyand press Enter. This removes the read-only attribute. - Type
exitand press Enter, then close Command Prompt.
If that does not work, the drive may have a registry-level write protection. Open Registry Editor (regedit) and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. If a WriteProtect value exists, set it to 0 and restart your computer. If the key does not exist, you can create it, but be careful—incorrect registry edits can cause problems.
Close Programs That Are Using the File
If a file is open in any program, Windows will not let you delete it. This often happens with documents, videos, or music files that are still playing or open in an editor. To fix this:
- Close all programs that might be using the file, including media players, word processors, and antivirus scans.
- If you are not sure which program is using it, open Task Manager (Ctrl+Shift+Esc), go to the "Processes" tab, and look for suspicious processes. You can also use the
openfilescommand in Command Prompt (requires admin) to list open files. - Restart your computer. This clears all file locks and is often the simplest fix.
Run Error Checking on the USB Drive
File system errors can cause deletion to fail. Windows has a built-in tool to scan and repair such errors:
- Open File Explorer, right-click the USB drive, and select Properties.
- Go to the Tools tab and click Check under Error Checking.
- If Windows says you need to scan the drive, click Scan and repair drive. Follow the prompts.
On macOS, you can use Disk Utility. Open Disk Utility, select the USB drive, and click First Aid. This will verify and repair the file system. If the drive is corrupted beyond repair, you may need to reformat it, which erases all data.
Use Safe Mode or Command Prompt to Delete Stubborn Files
If the above steps do not work, you can try deleting the file in Safe Mode, which loads only essential drivers and programs, reducing the chance of file locks. To boot into Safe Mode on Windows 10/11:
- Press Win + I to open Settings, go to System > Recovery.
- Under Advanced startup, click Restart now.
- After your PC restarts, choose Troubleshoot > Advanced options > Startup Settings > Restart.
- Press 4 or F4 to enable Safe Mode.
In Safe Mode, try deleting the file again. If that fails, you can use Command Prompt to force deletion:
- Open Command Prompt as administrator.
- Type
del /f /q "X:\path\to\file"(replace X with your drive letter and the path with the full file path). The /f forces deletion of read-only files, and /q suppresses confirmation.
Reformat the USB Drive as a Last Resort
If you cannot delete files due to severe corruption or persistent write protection, reformatting the drive will erase everything and restore it to a usable state. This is a last resort because it destroys all data on the drive. To format on Windows:
- Open File Explorer, right-click the USB drive, and select Format.
- Choose a file system (FAT32 for compatibility with most devices, exFAT for large files, or NTFS for Windows-only use).
- Check "Quick Format" if you want a faster process, then click Start.
On macOS, use Disk Utility, select the drive, and click Erase. Choose a format (exFAT is good for cross-platform use) and confirm.
Frequently Asked Questions
Why does my USB drive say "The disk is write-protected"?
This message means the drive is set to read-only. Check for a physical switch, then use the diskpart command or registry edit described above to clear the write-protect attribute. If neither works, the drive may be failing or have a hardware fault.
Can I recover files after formatting a USB drive?
Sometimes. If you used a quick format, data recovery software may be able to recover some files because the data is not immediately overwritten. However, if you used a full format or wrote new data to the drive, recovery becomes much harder. Always back up important files before formatting.
Why can I copy files to the USB but not delete them?
This is unusual but can happen if the file is marked as read-only or if your user account has write permission for the drive but not for that specific file. Check the file's properties and uncheck "Read-only" if it is checked. Also, ensure the drive is not full—some file systems prevent deletion when the drive has no free space for metadata.
Is it safe to use diskpart to clear write protection?
diskpart is a powerful tool, but using it on the wrong disk can erase data. Always double-check the disk number before selecting it. If you are unsure, use a different method like the registry edit or a third-party tool. There is no risk to the system as long as you select the correct disk.
Does the file system affect deletion?
Yes. FAT32 and exFAT are simpler and generally allow deletion without issues. NTFS supports permissions and encryption, which can sometimes block deletion if the current user lacks the necessary rights. If you have permission problems, take ownership of the file or run the deletion as an administrator.
Can a virus cause files to be undeletable?
Yes, some malware sets files as read-only or hides them. Run a full antivirus scan on the USB drive and your computer. If the drive is infected, scanning may remove the malware and allow you to delete the files. In severe cases, reformatting is the only way to clean it.