How to delete files or folders which cannot be deleted

How to delete files or folders that won't delete

At times you may find to delete files or folders which cannot be deleted on your Windows computer. When you go to delete such undeletable files or folders you may get an Error message: Could not find this item.

 delete files or folders which cannot be deleted

The problem in deleting files or folders?

Sometimes the folder name is something like “My Folder “, If you look at the end of the file you have noticed, there is a space at the end of the file. If you have installed Windows 8, 8.1 or even 10 on your PC, you can try to create a folder which ends with space and you will see that Windows will automatically remove that space which is located at the end or the beginning of the file name!

That’s the problem!
In previous versions of Microsoft Windows, such as XP or Vista, I think Windows let users create a file or folder with trailing space.

For example, I have a folder which is called “New Folder “, (look at the space at the end!) When I try to remove it in Windows Explorer, Windows will try to remove “New Folder” (without space at the end) and it will give me an error “Could not find the item”.

How to delete files or folders which cannot be deleted

 So, let’s see how to delete files or folders which cannot be deleted:

1.Right click on Windows button and select “Command Prompt (Admin).”

command prompt with admin rights

2.Then locate the folder in which you have the file or folder which you want to delete.

locate the file or folder which you want to delete

3.Now type cd and copy the address where your folder or file is located and paste it in command prompt or cmd like this: [just edit your path, not this one]

cd c:\Users\YourUserName\Desktop

And then press enter.
cd command

4.After that you will see that you are inside the folder because your path has changed, now type this and then press Enter:

dir /x

dir x cmd

5.After that, you will see a list of files in the folder and search for your folder or file which you can’t delete.

In my case it is AFTERE~1

6.Now after finding the file, see it has a specific name something like ABCD~1 and not the actual file name.

7.Type the following line, just edit the filename with the name which you find above which is allotted to your file name and press Enter:

rmdir /q /s your file name

 delete files or folders which cannot be deleted

8.Finally you have successfully deleted the folder, go and check.

folder finally deleted with cmd

You may also like:

It seems this fix was easy and you no longer have to deal with unwanted files or files which cannot be deleted. If you still have any queries regarding this guide please feel free to ask them in comments.

Posted by

Aditya Farrad

Aditya is a skilled tech writer with 10 years of experience in the field. He has a strong background in Troubleshooting, and has a talent for simplifying complex technical concepts for a general audience. He has worked with a variety of clients in the technology industry, creating user manuals, technical documentation, and instructional materials. With his combination of technical knowledge and writing talent, he is able to create clear, accurate, and engaging content that helps users get the most out of their technology.

12 Comments

  1. The path you entered, is too long. Enter a shorter path
    File Name could not be found. Check the spelling of the filename,
    and verify that the file location is correct.

  2. Long Path Tool is very useful if you are having problems in deleting, unlocking, copying and even renaming files that are considered filename too long by your system. Yes, these problems can occur even while using the latest Windows Explorer or FAR in managing your files. This tool can help you simplify files names that are categorized as filename too long by your system.

  3. i am getting this error,
    The system cannot find the file specified.
    also tried by using safemode but vain, there’s also no info in that folder security tab

  4. This is incredibly simple, and useful. Many thanks for this help

  5. This was brilliant – thankyou

  6. Didn’t work. Still get a message that all the included directory names are invalid.

  7. You can also try archiving the file or folder and check the box to delete files after archiving, then delete the rar.

  8. I have a folder that I cannot delete within a command prompt with elevated privileges.

    C:\Users\fmcgr\Videos\VideoProc>dir
    Volume in drive C is OS
    Volume Serial Number is DE02-2AD5

    Directory of C:\Users\fmcgr\Videos\VideoProc

    12/21/2019 10:40 PM .
    12/21/2019 10:40 PM ..
    12/12/2019 08:48 PM homecoming queen
    0 File(s) 0 bytes
    3 Dir(s) 74,159,046,656 bytes free

    C:\Users\fmcgr\Videos\VideoProc>del /f “homecoming queen”
    Could Not Find C:\Users\fmcgr\Videos\VideoProc\homecoming queen

    C:\Users\fmcgr\Videos\VideoProc>del /f “homecoming queen ”
    Could Not Find C:\Users\fmcgr\Videos\VideoProc\homecoming queen

    C:\Users\fmcgr\Videos\VideoProc>

    What can I do to accomplist removing this folder?

  9. Tried several methods before stumbling on this one and low and behold……it worked!! Curious what the purpose of tagging the folder differently was for other than an embedded TSR. Oh well easy come, not so easy go.

  10. Very clear, worked perfectly. Thank you

  11. At step 5, I don’t see the file’s name appearing that I wanna delete. I did all the previous steps correctly but the name of the file doesn’t appear anywhere when I entered the command. I checked the original location of the file and typed the address correctly but it’s nowhere to be found in the code. The file still exists at it’s original place though.

    I’ve been looking for a solution to fix this problem for about an hour, so please reply if you have a solution to this.

  12. Have found that stage five no longer works on windows 10 build 2004 dir /X does nothing different to plain dir
    Have had this problem numerous times over the years and this mechanism worked! No longer. Microsoft seem intent on stripping all the useful tools out of windows and replacing it with garbage for Muppets. Looking here as I am trying to find an alternative method as a client has managed to create several ghost files (they are there but windows can’t see them!)

Leave a Reply

Your email address will not be published. Required fields are marked *