{"id":6319,"date":"2018-07-21T20:55:00","date_gmt":"2018-07-21T20:55:00","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=6319"},"modified":"2022-10-03T18:17:52","modified_gmt":"2022-10-03T12:47:52","slug":"delete-a-stubborn-file-folder-in-windows","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/delete-a-stubborn-file-folder-in-windows\/","title":{"rendered":"How to Delete a Stubborn Undeletable File or Folder in Windows"},"content":{"rendered":"<p>Many of you would have come across situations where you can&#8217;t delete a file or folder no matter how you try. This article discusses the ways to delete files or folders that are stubborn or undeletable using normal methods.<\/p>\n<p><!--more--><\/p>\n<div id=\"toc\">\n<p>There could be at least 4 reasons you cannot remove those stubborn files or folders.<\/p>\n<ol>\n<li><a href=\"#inuse\">The file or folder is currently in use by some program<\/a>\n<ul>\n<li><a href=\"#restart_shell\">Option 1: Restart the Explorer Shell<\/a><\/li>\n<li><a href=\"#iobit\">Option 2: Use IOBit Unlocker<\/a><\/li>\n<li><a href=\"#procexp\">Option 3: Use Process Explorer to close the handle<\/a><\/li>\n<li><a href=\"#movefile\">Option 4: Use MoveFile.exe to delete or rename file\/folder on reboot<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#invalid_char\">Can&#8217;t delete files or folders having invalid character in their names<\/a>\n<ul>\n<li><a href=\"#winrar\">Using WinRAR to delete an invalid file or folder<\/a> <span style=\"background-color: #ffff00;\">Easiest option!!<\/span><\/li>\n<li><a href=\"#internal_syntax\">Manually deleting a file or folder containing an invalid name<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#permissions\">You don&#8217;t have the required NTFS permissions<\/a><\/li>\n<li><a href=\"#corruption\">File system corruption<\/a><\/li>\n<\/ol>\n<\/div>\n<h2>How to Delete a Stubborn Undeletable File or Folder in Windows<\/h2>\n<h3><a id=\"inuse\"><\/a>&#8220;File in Use&#8221; Scenario<\/h3>\n<p>There are umpteen software programs that help you release the lock on a file\/folder by some application. Utilities like Unlocker and Process Explorer will help you forcibly close the file or folder handle and then delete the file or folder.<\/p>\n<p>Before resorting to using those programs, first see if you can delete the stubborn file after logging off and logging in again, or after a restart cycle. It helps in most cases. Even better, start Windows in Safe mode and delete the stubborn file or folder. See how to\u00a0<a href=\"https:\/\/www.winhelponline.com\/blog\/start-windows-11-or-10-safe-mode\/\">Start your PC in safe mode<\/a> in Windows 10 or 11.<\/p>\n<p>If you want to delete the file or folder without having to restart Windows, you can use tools like <strong>Process Explorer<\/strong> or <strong>Unlocker<\/strong>. These tools help you find the program\/executable is causing the problem, release the lock and delete the file.<\/p>\n<p><em><strong><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6338\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/icotip.gif\" alt=\"tips bulb icon\" width=\"34\" height=\"34\" \/><\/strong>You can also use the built-in <strong>Resource Monitor<\/strong> to view the offending program, but Resource Monitor can&#8217;t be used to close the file handle. For more information, see the post <a href=\"https:\/\/www.winhelponline.com\/blog\/find-process-locked-file-openfiles-utility\/\">Find Which Process Has Locked a File Without 3rd Party Tools<\/a>.<\/em><\/p>\n<h4><a id=\"restart_shell\"><\/a>Restart Explorer Shell<\/h4>\n<p><strong>File Explorer<\/strong> may sometimes have a lock on media files hooked up by its shell extensions generally. If that&#8217;s the case, cleanly exiting the Explorer shell will help. Here is how to <a href=\"https:\/\/www.winhelponline.com\/blog\/exit-explorer-restart-windows-10-8\/\">cleanly terminate and restart the Explorer shell<\/a> in Windows 7 through 10.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6335\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/exit-restart-explorer-task-manager.png\" alt=\"cleanly restart explorer via task manager\" width=\"590\" height=\"555\" \/><\/p>\n<p>Note that in Windows 7 and above, the Windows &#8220;File in use&#8221; dialog will show you the name of the program using the file. All you need to do is first close the program.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6323\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/file-in-use-program-name.png\" alt=\"file in use - showing program name locked the file\" width=\"449\" height=\"268\" \/><\/p>\n<p>However, the program name may not be displayed in some cases, and that&#8217;s why we need tools like Unlocker, Process Explorer or Resource Monitor.<\/p>\n<h4><a id=\"iobit\"><\/a>IObit Unlocker<\/h4>\n<p><a href=\"https:\/\/www.iobit.com\/en\/iobit-unlocker.php\" target=\"_blank\" rel=\"noopener noreferrer\">IObit Unlocker<\/a> setup adds a context menu extension for files and folders. When you right-click on a file or folder and click IObit Unlocker, it shows which program is using the target file or folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6324\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/iobit-unlocker.png\" alt=\"IObit unlocker\" width=\"633\" height=\"391\" \/><\/p>\n<p>Unlocker also offers you these options, which are self-explanatory even for end-users:<\/p>\n<ul>\n<li>Unlock<\/li>\n<li>Unlock &amp; Delete<\/li>\n<li>Unlock &amp; Rename<\/li>\n<li>Unlock &amp; Move<\/li>\n<li>Unlock &amp; Copy<\/li>\n<li><strong>Forced mode<\/strong><\/li>\n<\/ul>\n<p>You can try &#8220;Forced mode&#8221; if unlock fails in normal mode. It&#8217;s an aggressive mode wherein it terminates the related processes rather than just closing the file\/folder handle.<\/p>\n<hr \/>\n<h3><a id=\"procexp\"><\/a>Process Explorer<\/h3>\n<p>Process Explorer is an excellent tool that needs no introduction. We&#8217;ve <a href=\"https:\/\/www.google.co.in\/search?q=process+explorer+site%3Awinhelponline.com\" target=\"_blank\" rel=\"noopener noreferrer\">covered Process Explorer many times<\/a> in the past.<\/p>\n<p>Launch Process Explorer <strong>as administrator<\/strong>. Use the <strong>Find<\/strong> option (<kbd>Ctrl<\/kbd> + <kbd>F<\/kbd>), type in the part of the file name, and press <kbd>Enter.<\/kbd><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6325\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/file-in-use-name-process-explorer.png\" alt=\"process explorer find locked files process\" width=\"682\" height=\"368\" \/><\/p>\n<p>You&#8217;ll see the process which is using that file.\u00a0All you need to do is close the program manually, and then delete the stubborn file.<\/p>\n<p>Also, Process Explorer lets you close the file handle via the lower pane view. However, exiting the program is the most preferred way.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6326\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/file-in-use-close-handle-process-explorer.png\" alt=\"process explorer close handle - lower pane view\" width=\"704\" height=\"689\" \/><\/p>\n<h4><a id=\"movefile\"><\/a>MoveFile.exe from Windows SysInternals<\/h4>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/sysinternals\/downloads\/movefile\" target=\"_blank\" rel=\"noopener noreferrer\">MoveFile<\/a> utility (to be run from <a href=\"https:\/\/www.winhelponline.com\/blog\/open-elevated-command-prompt-windows\/\">administrator Command Prompt<\/a> window) allows you to schedule move and delete commands for the next reboot.<\/p>\n<p><strong>Usage:<\/strong><\/p>\n<pre>movefile.exe [source] [dest]<\/pre>\n<p>Specifying an empty destination (&#8220;&#8221;) deletes the source at boot. An example that deletes <code>stubborn.pdf<\/code> is:<\/p>\n<p><strong>Example<\/strong><\/p>\n<pre>movefile d:\\tools\\stubborn.pdf \"\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6336\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/movefile-example-delete-on-reboot.png\" alt=\"movefile - delete file or folder on reboot\" width=\"700\" height=\"165\" \/><\/p>\n<p><strong><img decoding=\"async\" class=\"alignleft size-full wp-image-6337\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/hand-arrow.png\" alt=\"arrow hand symbol\" width=\"40\" \/>The MoveFile utility works not just for files, but for folders as well!<\/strong><\/p>\n<p>To delete (on reboot) a folder named &#8220;1&#8221; located on my desktop, I used this command:<\/p>\n<pre>movefile C:\\Users\\ramesh\\desktop\\1 \"\"<\/pre>\n<p>The job was perfectly completed after a restart!\u00a0The MoveFile utility uses MoveFileEx API to rename or delete a file. It registers the delete or rename operation in a <code>MULTI_STRING<\/code> registry value named <code>PendingFileRenameOperations<\/code>, under the following branch:<\/p>\n<pre>HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6327\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/movefile-pendingfilerenameoperations.png\" alt=\"movefile pendingfilerenameoperations\" width=\"672\" height=\"415\" \/><\/p>\n<p>During the next restart, the Session Manager performs the delete or rename task by reading the registered rename and delete commands from the <code>PendingFileRenameOperations<\/code> registry value. As you can see in the above screenshot, Windows Defender seems to have scheduled a delete operation (to get rid of a superseded driver file) after a signature update.<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/sysinternals\/downloads\/movefile\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Download MoveFile<\/strong><\/a> from Windows Sysinternals.<\/p>\n<hr \/>\n<h3><a id=\"invalid_char\"><\/a>Files or folders having reserved names or invalid characters in their names<\/h3>\n<p><strong>Sample scenario:\u00a0 Can&#8217;t <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-windows-old-folder-previous-versions\/\">empty Windows.old<\/a> using Disk Cleanup or Storage Settings as the files in Cortana &#8220;LocalState&#8221; folder remains undeletable<\/strong><\/p>\n<p>IOBit Unlocker is also helpful when you&#8217;re unable to clear out the <code>Windows.old<\/code> folder (which stores the <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-windows-old-folder-previous-versions\/\">previous Windows installation<\/a> files) after installing the latest Feature Update. Windows.old may sometimes be undeletable due to a problem (<strong>invalid characters<\/strong> in the file name) with files under the <code>Microsoft.Windows.Cortana_cw5n1h2txyewy<\/code> folder under <code>C:\\Windows.old<\/code>. The complete path for the problematic folder is below:<\/p>\n<pre>C:\\Windows.old\\Users\\{username}\\AppData\\Local\\Packages\\Microsoft.Windows.Cortana_cw5n1h2txyewy<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6557\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/cortana-inaccessible-folder-2.png\" alt=\"cannot delete cortana localstate folder inaccessible\" width=\"856\" height=\"635\" \/><\/p>\n<p>As you can see, the folder <code>LocalState<\/code> has a couple of dots (..) after its name, which could be preventing the folder from being deleted or accessed. Attempts to delete the folder result in the following error:<\/p>\n<pre class=\"err\">An unexpected error is keeping you from deleting the folder. If you continue to receive this error, you can use the error code to search for help with this problem.\r\n\r\nError 0x80004005: Unspecified error\r\n<\/pre>\n<p>with options to <code>Try Again<\/code>, <code>Skip<\/code> or <code>Cancel<\/code> the operation.<\/p>\n<p>(or)<\/p>\n<pre class=\"err\"><strong>Location is not available<\/strong>\r\n\r\nC:\\Windows.old\\Users..\\AppData\\Local\\packages\\Microsoft.Windows.Cortana_cw5n1h2txyewy\\LocalState is unavailable. If the location is on this PC, make sure the device or drive is connected or the disc is inserted, and then try again. If the location is on a network, make sure you're connected to the network or Internet, and then try again. If the location still can't be found, it might have been moved or deleted.<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6559\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/cortana-inaccessible-folder-1.jpg\" alt=\"cannot access cortana localstate folder inaccessible\" width=\"701\" height=\"424\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6419\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/08\/hand.png\" alt=\"hand point icon\" width=\"49\" height=\"27\" \/>Easy fix: In <strong>IOBit Unlocker<\/strong>, choose the option <strong>Unlock &amp; Delete<\/strong> after selecting the <code>Cortana<\/code> folder (or the entire <code>Windows.old<\/code> folder). This\u00a0will help you <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-windows-old-folder-previous-versions\/\">completely wipe out Windows.old folder<\/a> easily.<\/p>\n<hr \/>\n<h4><a id=\"winrar\"><\/a>Using WinRAR to delete an invalid file or folder (easiest option)<\/h4>\n<p>WinRAR&#8217;s file manager can handle files and folders that have Unicode or hidden characters in the file name. Using WinRAR, you can rename or delete files or folders containing invalid characters, trailing spaces, or dots.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28895\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/del-stubborn-file-winrar-1.png\" alt=\"winrar delete stubborn file or folder\" width=\"514\" height=\"400\" \/><\/p>\n<p>You can easily rename or delete a problematic file using WinRAR&#8217;s file manager user interface.<\/p>\n<ul>\n<li>Download WinRAR and run it.<\/li>\n<li>In WinRAR, browse the parent folder that has the problematic file or subfolder.<\/li>\n<li>Right-click on the item and choose <strong>Rename<\/strong>.<\/li>\n<li>Assign a valid name that the Windows Operating System will support.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28892\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/del-stubborn-file-winrar-4.png\" alt=\"winrar delete stubborn file or folder\" width=\"515\" height=\"454\" \/><\/li>\n<\/ul>\n<p>To <strong>delete<\/strong> a file (instead of renaming it), press <kbd>Shift<\/kbd> + <kbd>Del<\/kbd> (for permanent deletion) or <kbd>Del<\/kbd> (to send it to Recycle Bin).<\/p>\n<p>Note that the <kbd>Del<\/kbd> command may not work in some cases &#8212; e.g., the file name contains invalid characters, or the file name is too long. It would ask you to use <kbd>Shift<\/kbd> + <kbd>Del<\/kbd> to delete the file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28894\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/del-stubborn-file-winrar-2.png\" alt=\"winrar delete stubborn file or folder\" width=\"482\" height=\"261\" \/><\/p>\n<p>So, press <kbd>Shift<\/kbd> + <kbd>Del<\/kbd> for permanent deletion, and click Yes to proceed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28893\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/del-stubborn-file-winrar-3.png\" alt=\"winrar delete stubborn file or folder\" width=\"611\" height=\"401\" \/><\/p>\n<p>voil\u00e0! The stubborn file\/folder is now gone. Thanks to WinRAR for making the job very easy!<\/p>\n<p><strong>The case of the duplicate Windows directory<\/strong><\/p>\n<p>Here&#8217;s another case where a duplicate &#8220;Windows &#8221; directory (with a trailing space) appeared after updating Windows.<\/p>\n<p>Attempting to access the folder contents caused the error &#8220;Location is not available&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28949\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/duplicate-windows-dir.png\" alt=\"duplicate windows directory - inaccessible\" width=\"743\" height=\"295\" \/><\/p>\n<p>Attempting to delete the item via Safe mode caused the following error:<\/p>\n<pre class=\"err\">The action can't be completed because the folder or the file in it is open in another program.<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28950\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/duplicate-windows-dir-2.png\" alt=\"duplicate windows directory - inaccessible\" width=\"681\" height=\"283\" \/><\/p>\n<p><em>Looking at the timestamp in the error message, it appears as if the delete command was being executed on the real &#8220;Windows&#8221; folder instead of the duplicate &#8220;Windows &#8221; folder, even though the user selected the duplicate Windows folder and pressed the Del key. This is a strange situation where the File ID returned by FsUtil.exe (and the Inode ID returned by WSL) were exactly the same for both folders.<\/em><\/p>\n<p><em>A Windows user named <a href=\"https:\/\/answers.microsoft.com\/en-us\/windows\/forum\/windows_11-wintop_update\/duplicate-windows-directories-after-win-11-upgrade\/ff2b597a-204a-4ab6-82d1-8a84bfb38517?messageId=539d40a0-be66-466e-9d2a-8a6ae97c3e59\" target=\"_blank\" rel=\"noopener\">Angelo<\/a> indicated that WinRAR helped her nuke the stubborn and inaccessible &#8220;Windows &#8221; folder. Note that the Windows Subsystem for Linux (WSL) was unable to see the duplicate Windows directory. WSL returned the same INODE for both &#8220;Windows&#8221; and &#8220;Windows &#8221; directories.<\/em><\/p>\n<p>Fortunately, the WinRAR method worked!<\/p>\n<hr \/>\n<h4><a id=\"internal_syntax\"><\/a>Deleting file names (with reserved characters) manually<\/h4>\n<p><strong>If you want to wipe off those invalid files and folders manually, you can use the internal syntax &#8220;<code>\\\\?\\<\/code>&#8221; for file or folder paths. See examples and screenshots below:<\/strong><\/p>\n<div class=\"qt\">\n<h4><a id=\"reserved\"><\/a>Invalid or reserved characters in the filename<\/h4>\n<p><em>You 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 &#8220;\\\\?\\&#8221; syntax with some tools to operate on these files, for example:<\/em><\/p>\n<pre class=\"cmd\">del \"\\\\?\\c:\\path_to_file_that contains a trailing space.txt \"<\/pre>\n<p><em>Src: Excerpt from Microsoft KB <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/320081\/you-cannot-delete-a-file-or-a-folder-on-an-ntfs-file-system-volume\">You cannot delete a file or a folder on an NTFS file system volume<\/a><\/em><\/p>\n<p>Here&#8217;s an example where a file had a trailing space and the usual <code>del *.*<\/code> command didn&#8217;t work out. It returned the error &#8220;The system cannot find the file specified&#8221;:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-27490\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/stubborn-file-1.png\" alt=\"stubborn file with trailing space\" width=\"641\" height=\"459\" \/><\/p>\n<p>However, using the internal syntax (&#8220;<code>\\\\?\\<\/code>&#8220;) and including the trailing space made deletion of the file possible.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-27492\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/stubborn-file-3.png\" alt=\"stubborn file with trailing space\" width=\"753\" height=\"311\" \/><\/p>\n<\/div>\n<h4>EXAMPLE: Deleting folders with reserved names or having invalid characters (such as dots and spaces) in the name.<\/h4>\n<p>To delete the <code>LocalState..<\/code> folder under the Cortana Package folder, here is the path and command-line you use:<\/p>\n<pre>rd \/s \\\\?\\C:\\Windows.old\\Users\\%username%\\AppData\\Local\\Packages\\Microsoft.Windows.Cortana_cw5n1h2txyewy\\LocalState..\\<\/pre>\n<p>Run that command from an <a href=\"https:\/\/www.winhelponline.com\/blog\/open-elevated-command-prompt-windows\/\">administrator Command Prompt<\/a>.<\/p>\n<p><strong>Another example:<\/strong><\/p>\n<p>Let&#8217;s say we have some invalid folders, namely <code>Con<\/code>, <code>Conduct.<\/code> and <code>LocalState..<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8670\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-1.png\" alt=\"delete folder reserved or invalid characters in name\" width=\"701\" height=\"411\" \/><\/p>\n<p>(Note that the word <code>con<\/code> is a <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/320081\/you-cannot-delete-a-file-or-a-folder-on-an-ntfs-file-system-volume\" target=\"_blank\" rel=\"noopener noreferrer\">reserved name<\/a>, and shouldn&#8217;t be used in file or folder names.)<\/p>\n<p>Attempting to access the folder with a reserved name normally (e.g., <code>con<\/code>) causes the following error:<\/p>\n<pre class=\"err\">Location is not available\r\n\r\npath:\\con is not accessible.\r\n\r\nThe handle is invalid.\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8671\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-0.png\" alt=\"the handle is invalid - invalid file or folder name\" width=\"352\" height=\"163\" \/><\/p>\n<p>To delete the folder, we&#8217;ll now run the following command from the <a href=\"https:\/\/www.winhelponline.com\/blog\/open-elevated-command-prompt-windows\/\" target=\"_blank\" rel=\"noopener noreferrer\">admin Command Prompt<\/a>:<\/p>\n<pre>rd \/s \"\\\\?\\C:\\con\"<\/pre>\n<p>The other two folders namely <code>conduct.<\/code> and <code>LocalState..<\/code> have invalid characters (.) in the file name. Let&#8217;s run the following commands to delete those folders:<\/p>\n<pre>rd \/s \"\\\\?\\C:\\conduct.\"\r\nrd \/s \"\\\\?\\C:\\LocalState..\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8669\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-2.png\" alt=\"delete folder reserved or invalid characters in name\" width=\"701\" height=\"141\" \/><\/p>\n<p>Voila! The three folders are now removed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8668\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-3.png\" alt=\"delete folder reserved or invalid characters in name\" width=\"702\" height=\"332\" \/><\/p>\n<p><small><em>For more information on dealing with files containing reserved or invalid characters, see Microsoft article <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/320081\/you-cannot-delete-a-file-or-a-folder-on-an-ntfs-file-system-volume\" target=\"_blank\" rel=\"noopener noreferrer\">You cannot delete a file or a folder on an NTFS file system volume<\/a>.<\/em><\/small><\/p>\n<hr \/>\n<h3><a id=\"permissions\"><\/a>Incorrect NTFS Permissions<\/h3>\n<p>If your user account control lacks the permissions to modify a file or folder, you&#8217;ll see the &#8220;permission denied&#8221; dialog when attempting to delete it. All you need to do is take ownership of the file or folder, assign your account full control permissions before deleting the file.<\/p>\n<p>You can take ownership of files\/folders and assign permissions via Properties, Security tab. But some users prefer the command-line method using <code>Takeown.exe<\/code>\u00a0and\u00a0<code>ICacls.exe<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3282 alignnone\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/05\/takeown-cmd.png\" alt=\"Take Ownership using command-line takeown.exe\" width=\"600\" height=\"300\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6337\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/hand-arrow.png\" alt=\"arrow hand symbol\" width=\"64\" height=\"42\" \/>For detailed information, see our illustrative article\u00a0<a href=\"https:\/\/www.winhelponline.com\/blog\/take-ownership-of-file-or-folder\/\">how to take ownership of the file(s) and folder(s)<\/a>\u00a0(using <code>Takeown.exe<\/code>, even recursively across sub-folders). It also describes how to assign permissions using <code>icacls.exe<\/code>.\u00a0Alternately, you can launch Command Prompt under <a href=\"https:\/\/www.winhelponline.com\/blog\/run-program-as-system-localsystem-account-windows\/\">System<\/a> or <a href=\"https:\/\/www.winhelponline.com\/blog\/run-program-as-trustedinstaller-locked-registry-keys-files\/\">TrustedInstaller<\/a> privileges to force delete an undeletable file or folder.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6338\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/icotip.gif\" alt=\"tips bulb icon\" width=\"34\" height=\"34\" \/>Related Tip:<\/strong> For easier access, you can even add &#8220;Take Ownership &amp; Assign Full permissions&#8221; <a href=\"https:\/\/www.winhelponline.com\/blog\/take-ownership-via-right-click-context-menu-add\/\">option to the right-click menu<\/a>, especially if you&#8217;re going to use the option more frequently. This registry tweak does the <code>Takeown.exe<\/code> and <code>ICacls.exe<\/code> operations in one go. No need to type those commands manually!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4022\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/09\/take_ownership_context_menu.png\" alt=\"take ownership right-click menu\" width=\"380\" height=\"571\" \/><\/p>\n<h3><a id=\"corruption\"><\/a>File system corruption<\/h3>\n<p>File system corruption causes errors such as &#8220;<em><strong>The File or Directory is Corrupted and Unreadable<\/strong><\/em>&#8221; when accessing or deleting a file or folder. Running disk Error Checking or <code>Chkdsk<\/code> command ought to fix the problem.<\/p>\n<h4>Error Checking<\/h4>\n<p>Open This PC (my Computer), right-click on the drive which contains the stubborn file, and click Properties. Select the Tools menu, and click &#8220;Check&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6332\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/w10-error-checking-1.png\" alt=\"disk error checking windows\" width=\"363\" height=\"202\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6330\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/w10-error-checking-4.png\" alt=\"disk error checking windows\" width=\"542\" height=\"231\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6331\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/w10-error-checking-3.png\" alt=\"disk error checking windows\" width=\"352\" height=\"199\" \/><\/p>\n<p>Clicking the\u00a0<strong>Show Details<\/strong> link opens the relevant Event Viewer entry in the Application Log. It tells you what the problem is.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6328\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/error-checking-event-log.png\" alt=\"error checking - application event log error\" width=\"589\" height=\"532\" \/><\/p>\n<p>Then proceed to repair the drive now, or on the next restart as you so prefer.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6329\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/w10-error-checking-5.png\" alt=\"disk error checking windows\" width=\"370\" height=\"164\" \/><\/p>\n<h4>Chkdsk<\/h4>\n<p>Alternately, you can run <code>Chkdsk &lt;driveletter:&gt; \/R<\/code> from an elevated Command Prompt. It asks for your consent to dismount the drive and run a scan. If you choose &#8220;<code>N<\/code>&#8221; (No), it&#8217;ll prompt for scheduling a scan at the next reboot. Click <code>Y<\/code> to continue.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6321\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2018\/07\/w10-chkdsk.png\" alt=\"chkdsk repair drive\" width=\"700\" height=\"271\" \/><\/p>\n<p>After fixing the file system errors using disk Error checking or Chkdsk, see if you can delete the stubborn file or folder.<\/p>\n<p><em>If you know any other interesting methods to delete files that are otherwise &#8220;undeletable&#8221;, post them in the Comments section below.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many of you would have come across situations where you can&#8217;t delete a file or folder no matter how you try. This article discusses the ways to delete files or folders that are stubborn or undeletable using normal methods.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[6,7],"tags":[412],"class_list":["post-6319","post","type-post","status-publish","format-standard","hentry","category-utilities","category-windows","tag-process-explorer"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":8402,"url":"https:\/\/www.winhelponline.com\/blog\/could-not-find-this-item-when-deleting-file-folder-windows\/","url_meta":{"origin":6319,"position":0},"title":"[Fix] &#8220;Could not find this item&#8221; When Deleting a File or Folder in Windows","author":"Ramesh","date":"March 31, 2019","format":false,"excerpt":"When you attempt to delete a file or folder on your Windows computer, the \"Item not found\" error may appear. Here is the full error message: Could not find this item. This is no longer located in [folder path]. Verify the item's location and try again. This article explains how\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"delete folder reserved or invalid characters in name","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/03\/delete-invalid-handle-folder-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1590,"url":"https:\/\/www.winhelponline.com\/blog\/delete-windows-old-folder-previous-versions\/","url_meta":{"origin":6319,"position":1},"title":"How to Delete Windows.old folder [Previous versions of Windows]","author":"Ramesh","date":"February 6, 2016","format":false,"excerpt":"Windows Operating System upgrades and version updates would leave plenty of files behind in the system drive. This is because Windows keeps the files from the previous versions of Windows in a separate folder in case the user wants to roll back the major update (or OS upgrade). For instance,\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"how to delete windows.old folder","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/cortana-localstate-folder-delete.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/cortana-localstate-folder-delete.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/cortana-localstate-folder-delete.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":19688,"url":"https:\/\/www.winhelponline.com\/blog\/compressed-zip-folder-error-file-not-found-no-read-permission\/","url_meta":{"origin":6319,"position":2},"title":"Compressed (Zipped) Folder Error &#8220;File not found or no read permission&#8221;","author":"Ramesh","date":"November 4, 2020","format":false,"excerpt":"When you try to create a compressed (zipped) folder in Windows 10, the following error occurs: Compressed (zipped) Folders Error File not found or no read permission. You may have noticed that this error doesn't happen on drives formatted as FAT32.\u00a0This article explains why this problem occurs and how to\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"compressed folder create error - no read permissions - process explorer","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/11\/procexp-find-locked-files.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/11\/procexp-find-locked-files.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/11\/procexp-find-locked-files.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1561,"url":"https:\/\/www.winhelponline.com\/blog\/quick-access-home-stuck-pinned-items-reset\/","url_meta":{"origin":6319,"position":3},"title":"[Fix] Quick Access Pinned Shortcuts Stuck or Not Working","author":"Ramesh","date":"February 3, 2016","format":false,"excerpt":"Quick access (Home) in Windows 10 and 11 provides a convenient way to access folders you frequently use by pinning them. However, in some situations, the pinned shortcuts in Quick access get stuck, and you cannot remove or unpin them. Quick access sometimes loses track of a target folder if\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/remove-stuck-pin-quick-access.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/remove-stuck-pin-quick-access.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/remove-stuck-pin-quick-access.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/02\/remove-stuck-pin-quick-access.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5031,"url":"https:\/\/www.winhelponline.com\/blog\/ribbon-command-right-click-menu-windows-10\/","url_meta":{"origin":6319,"position":4},"title":"How to Add a Ribbon Command to Right-click Menu in Windows 10","author":"Ramesh","date":"December 29, 2016","format":false,"excerpt":"Ribbon UI consists of a command bar with a series of tabs. Each tab contains a set of commands such as Cut, Copy, Paste, etc. Ribbon UI was first introduced in Office 2007. Then it was included in File Explorer in Windows 8 and Windows 10. This article explains how\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"ribbon command in right-click menu","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/add-ribbon-context-menu-5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/add-ribbon-context-menu-5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/add-ribbon-context-menu-5.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":9058,"url":"https:\/\/www.winhelponline.com\/blog\/failed-to-enumerate-objects-in-the-container-ownership\/","url_meta":{"origin":6319,"position":5},"title":"Fix: &#8220;Failed to Enumerate Objects in the Container&#8221; Error","author":"Ramesh","date":"May 6, 2019","format":false,"excerpt":"When you try to open a folder, you may see the message \"You don't currently have permission to access this folder.\u00a0Click Continue to permanently get access to this folder.\" Clicking on the Continue shows the message \"You have been denied permission to access this folder.\u00a0To gain access to this folder\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"failed to enumerate objects in the container - change ownership recursively sub-folders","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/w10-safe-mode-win-re.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/6319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=6319"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/6319\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=6319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=6319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=6319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}