To continue receiving security updates for Windows, make sure you're running Windows XP with Service Pack 3 (SP3). For more information, refer to this Microsoft web page: Support is ending for some versions of Windows
Cause 1: The file uses an ACLYou may not be able to delete a file if the file uses an Access Control List (ACL). To resolve this issue, change the permissions on the file. You may have to take ownership of the files to be able to change the permissions.
Administrators have the implicit ability to take ownership of any file even if they have not been explicitly granted any permission to the file. File owners have the implicit ability to modify file permissions even if they are not explicitly granted any permissions to the file. Therefore, you may have to take ownership of a file, give yourself permissions to delete the file, and then delete the file.
You cannot use certain security tools to display or to modify permissions because the file has a non-canonical ACLTo work around this issue, use another tool (for example, a later build of Cacls.exe).
The Access Control Entries (ACEs) in an ACL have a certain preferred sequence depending on their type. For example, ACEs that deny access typically come before ACEs that grant access. However, nothing prevents a program from writing an ACL that has ACEs in any arbitrary sequence. In some earlier versions of Windows, issues occurred when Microsoft Windows tried to read these "non-canonical" ACLs. Sometimes, you cannot modify these ACLs correctly by using the Microsoft Windows Explorer graphical security editor. This issue has been corrected in later versions of Windows. If you are experiencing this issue, use the most recent version of Cacls.exe. Even if you cannot display or edit an ACL in place, you can write a new ACL that lets you to gain access to the file.
Cause 2: The file is being usedYou may not be able to delete a file if the file is being used. To resolve this issue, determine the process that has the open handle, and then close that process.
Depending on how the file is opened (for example, it is open for exclusive access instead of shared access), you may not be able to delete a file that is in use. You can use a variety of tools to help you determine the processes that have open handles to files whenever you want.For more information about tools to help the processes that have open handles to files, click the following article number to view the article in the Microsoft Knowledge Base:
Cause 3: File system corruption is preventing access to the fileYou may not be able to delete the file if the file system is corrupted. To resolve this issue, run the Chkdsk utility on the disk volume to correct any errors.
Bad sectors on the disk, other faulty hardware, or software bugs can corrupt the file system and put files in a problematic state. Typical operations may fail in a variety of ways. When the file system detects corruption, it logs an event to the event log and you typically receive a message that prompts you to run Chkdsk. Depending on the nature of the corruption, Chkdsk may or may not be able to recover file data; however, Chkdsk returns the file system to an internally consistent state. For additional information about using the Chkdsk utility, click the following article numbers to view the articles in the Microsoft Knowledge Base:
Cause 4: Files exist in paths that are deeper than MAX_PATH charactersYou may not be able to open, edit, or delete a file if there are issues with the file path.
Resolution 1: Use an auto-generated 8.3 name to access the fileTo resolve this issue, you may want to use the auto-generated 8.3 name to access the file. This resolution may be the easiest resolution if the path is deep because the folder names are too long. If the 8.3 path is also too long or if 8.3 names have been disabled on the volume, go to Resolution 2. For additional information about disabling 8.3 file names on NTFS volumes, click the following article number to view the article in the Microsoft Knowledge Base:
Resolution 2: Rename or move a deep folderRename the folder so that the target files that are deeper than the MAX_PATH no longer exist. If you do this, start at the root folder (or any other convenient place), and then rename folders so that they have shorter names. If this step does not resolve this issue (for example, if a file is more than 128 folders deep), go to Resolution 4.
Resolution 3: Map a drive to a folder in the structure of the pathMap a drive to a folder inside the structure of the path of the target file or folder. This method shortens the virtual path.
For example, suppose you have a path that is structured as follows:
Resolution 4: Use a network share that is as deep as the folderIf Resolution 1, 2, and 3 are not convenient or do not resolve the issue, create a network share that is as deep in the folder tree as you can, and then rename the folders by accessing the share.
Resolution 5: Use a tool that can traverse deep pathsMany Windows programs expect the maximum path length to be shorter than 255 characters. Therefore, these programs only allocate enough internal storage to handle these typical paths. NTFS does not have this limit and it can hold much longer paths.
You may experience this issue if you create a share at some point in your folder structure that is already fairly deep, and then create a deep structure below that points by using the share. Some tools that operate locally on the folder tree may not be able to traverse the whole tree starting from the root. You may have to use these tools in a special way so that they can traverse the share. (The CreateFile API documentation describes a method to traverse the whole tree in this situation.)
Typically, you can manage files by using the software that creates them. If you have a program that can create files that are deeper than MAX_PATH, you can typically use that same program to delete or manage the files. You can typically delete files that are created on a share by using the same share.
Cause 5: The file name includes a reserved name in the Win32 name spaceIf the file name includes a reserved name (for example, "lpt1") in the Win32 name space, you may not be able to delete the file. To resolve this issue, use a non-Win32 program to rename the file. You can use a POSIX tool or any other tool that uses the appropriate internal syntax to use the file.
Additionally, you may be able to use some built-in commands to bypass the typical Win32 reserved name checks if you use a particular syntax to specify the path of the file. For example, if you use the Del command in Windows XP, you can delete a file named "lpt1" if you specify the full path of the file by using the following special syntax:
You may be able to use a Win32 program to bypass the typical name checks that are performed when a file is created (or deleted) by using the same technique that you use to traverse folders that are deeper than MAX_PATH. Additionally, some POSIX tools are not subject to these name checks.
Cause 6: The file name includes an invalid name in the Win32 name spaceYou may not be able to delete a file if the file name includes an invalid name (for example, the file name has a trailing space or a trailing period or the file name is made up of a space only). To resolve this issue, use a tool that uses the appropriate internal syntax to delete the file. You can use the "\\?\" syntax with some tools to operate on these files, for example:
Combinations of causesSometimes, you may experience combinations of these causes, which can make the procedure to delete a file more complex. For example, if you log on as the computer's administrator, you may experience a combination of Cause 1 (you do not have permissions to delete a file) and Cause 5 (the file name contains a trailing character that causes file access to be redirected to a different or nonexistent file) and you may not be able to delete the file. If you try to resolve Cause 1 by taking ownership of the file and adding permissions, you still may not be able to delete the file because the ACL editor in the user interface cannot access the appropriate file because of Cause 6.
In this situation, you can use the Subinacl utility with the
/onlyfile switch (this utility is included in the Resource Kit) to change ownership and permissions on a file that is otherwise inaccessible, for example:
This sample command line modifies the C:\path_to_problem_file file that contains a trailing space so that the
domain\administrator account is the owner of the file and this account has full control over the file. You can now delete this file by using the Del command with the same "\\?\" syntax.
Article ID: 320081 - Last Review: May 17, 2017 - Revision: 2