When you’re working with files, whether on a USB drive, external hard drive, or even on your computer’s internal storage, you may encounter situations where you cannot delete or modify a file due to write protection. Write protection is a feature that prevents accidental data loss or modification, and while it’s a great safeguard, it can be frustrating when you need to delete or modify a file that’s been locked.
Hardware Write Protection: This is commonly found on external storage devices like USB drives, SD cards, or external hard drives. Some devices come with a physical switch that locks the storage, making it read-only.
Software Write Protection: This is a virtual lock applied via the operating system, often for system files or folders that need to be protected from accidental modification or deletion.

File System Write Protection: Sometimes, the file system itself (such as NTFS, FAT32. or exFAT) can become corrupted or marked as read-only due to errors, disk damage, or improper dismounting, causing files to become inaccessible for deletion.
Permissions Write Protection: On some operating systems, files and folders may be locked for editing by setting file permissions that only allow read access, but not write or delete access.
With this understanding, let’s go through several methods to delete write-protected files.
1. Check the Hardware Write Protection Switch
Some external storage devices, such as USB drives, SD cards, or external hard drives, come with a physical switch that enables or disables write protection. If you’re trying to delete a file from such a device and it’s not working, it could be because the device has been locked by this physical switch.
Steps:
Locate the Switch: For SD cards and some USB drives, look for a small switch on the side of the device. The switch may have two positions: “Lock” (write-protected) and “Unlock” (write-enabled).
Slide the Switch: If the switch is in the “Lock” position, slide it to the “Unlock” position.
Reattempt the Deletion: Once the switch is in the unlocked position, try to delete the file again.
2. Use the DiskPart Command in Windows
Windows users can use the DiskPart utility to remove write protection from storage devices, including USB drives, external hard drives, or SD cards.
Steps:
Open Command Prompt: Press Windows + R, type cmd, and press Enter.
Run DiskPart: Type the following command and press Enter:
bash
diskpart
List Disks: To view all connected drives, type:
bash
list disk
Select the Write-Protected Disk: Identify the disk you want to modify (e.g., Disk 1. Disk 2) and select it by typing:
bash
select disk X
(Replace X with the actual disk number.)
Remove Write Protection: To remove the write protection, type the following command:
bash
attributes disk clear readonly
Exit DiskPart: Once the write protection has been cleared, type:
bash
exit
Reattempt Deletion: Try deleting the write-protected file again.
3. Use Registry Editor (For Software Write Protection)
If the write protection is applied at the software level via the registry, you can remove it by editing the Windows registry.
Warning: Editing the registry incorrectly can cause significant issues with your system. Be sure to back up your registry before making any changes.
Steps:
Open the Registry Editor: Press Windows + R, type regedit, and press Enter.
Navigate to the Write Protection Key: Go to the following path:
mathematica
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
Modify WriteProtect Value: If the StorageDevicePolicies key doesn’t exist, right-click the Control key and choose New > Key, then name it StorageDevicePolicies. In the right pane, if you see a WriteProtect entry, double-click it and set its value to 0. If it doesn’t exist, right-click the right pane and select New > DWORD (32-bit) Value, name it WriteProtect, and set its value to 0.
Exit the Registry Editor: Close the Registry Editor and restart your computer.
Reattempt Deletion: Try deleting the file again after restarting.
4. Check File Permissions
Sometimes, write protection is applied to files via user permissions. Files and folders may be set to “read-only,” preventing you from modifying or deleting them. To check and modify these permissions:
Steps:
Right-click the File or Folder: Navigate to the file or folder you want to delete, right-click on it, and select Properties.
Uncheck Read-Only: In the General tab of the properties window, under the Attributes section, uncheck the Read-only box, then click Apply.
Modify Permissions: Switch to the Security tab, and under the Group or user names section, select your user account. Click Edit and ensure that Full Control is allowed. If it’s not, enable it.
Apply and Exit: Click Apply, then OK to confirm the changes.
Reattempt Deletion: Once the permissions are set correctly, try deleting the file again.
5. Use Third-Party Tools
There are several third-party utilities available that can help remove write protection and delete files that are locked. Some of these tools can fix file system errors, repair corrupted drives, and force the deletion of write-protected files.
Some recommended tools include:
Unlocker: A free tool that helps you delete files that are locked by processes or write protection.
LockHunter: A file unlocker tool that can help you delete write-protected files by unlocking the file first.
IObit Unlocker: A useful utility to unlock and delete files that are locked due to write protection or being in use.
Steps:
Download and Install the Tool: Download one of the third-party tools mentioned above and install it on your system.
Run the Tool: Open the program and navigate to the file or folder you want to delete.
Unlock and Delete: Use the tool’s unlock feature to unlock the file or folder, then delete it.
Confirm Deletion: Once the file is unlocked, it should be deleted without issues.
6. Check for Disk Errors
Sometimes, disk errors or corruption can cause write protection. To check and fix these issues, you can use the built-in Windows Check Disk tool.
Steps:
Open Command Prompt as Administrator: Press Windows + X, then choose Command Prompt (Admin).
Run Check Disk Command: Type the following command and press Enter:
bash
chkdsk X: /f
(Replace X with the drive letter of the affected device.)
Allow the Scan to Complete: The tool will scan the disk for errors and fix them automatically.
Reattempt Deletion: Once the disk check is complete, try deleting the write-protected file again.
7. Format the Write-Protected Drive (Last Resort)
If none of the previous methods work and you absolutely need to delete the write-protected files, you can try formatting the drive. This will erase all data on the device, including any write protection.
Steps:
Back Up Data: Before proceeding, make sure to back up any important data from the write-protected drive, as formatting will erase everything.
Format the Drive: Right-click the drive in File Explorer, select Format, and choose the appropriate file system (e.g., NTFS for Windows or exFAT for cross-platform compatibility).
Complete the Format: Click Start and allow the format to complete. This will remove the write protection, and you will be able to delete files.
About us and this blog
Panda Assistant is built on the latest data recovery algorithms, ensuring that no file is too damaged, too lost, or too corrupted to be recovered.
Request a free quote
We believe that data recovery shouldn’t be a daunting task. That’s why we’ve designed Panda Assistant to be as easy to use as it is powerful. With a few clicks, you can initiate a scan, preview recoverable files, and restore your data all within a matter of minutes.
Subscribe to our newsletter!
More from our blog
See all postsRecent Posts
- Windows was unable to complete the format sd card 2025-02-14
- How to format sd card for canon camera? 2025-02-14
- Do sd cards need to be formatted? 2025-02-14