A number of reasons force users to delete files during the operations in Windows. Below listed are the situations where one is denied the delete operations.
- Does NOT have permission to delete the file
- You can try to use CACLS.EXE
CALCS FileName /G Administrators: F
Command will remove all ACLs on the file and grant the Administrators group Full Control.
- The file is in use
- Close the file.
You can use procexp.exe to determine the process that has the file open.
- The file system is corrupts
- Run CHKDSK /F /R to detect and fix the corruption.
CHKDSK may have to run at the next startup.
- The path to the file is too long
- Use the 8.3 short name, unless it has been disabled.
Type dir /x.
If the 8.3 path is too long, start renaming parent folders.
- The file name / path contains a reserved named
- Use del “\\?\\path_to_file.extension” to delete the file
- The file name contains a trailing space
- Use del “\\?\\path_to_file.extension” to delete the file.