Delete Undeletable Folders (directories) via CMD – SSNC

This is how to delete those pesky “can not delete file” folders. Those “Item not found” folders. Those creepy Ghost Folders!!

I was having an issue. On my desktop there was a folder. It was empty. It had 0 kilobytes (KB). I wanted to delete the folder. I clicked and dragged it to the trash and was promptly told the file didn’t exist.

The official error

Item not found” This is no longer located in C:\Users\NAME\Desktop. Verify the item’s location and try again.

How the F is that? I just dropped it into the trash!!

Luckily, I discovered that with a couple quick lines of code in the command prompt (CMD) on my windows 8 machine the problem could be solved.

First, launch the CMD. Right click the windows icon and choose Command Prompt.

From there the iconic black panel should pop up.

Now, you can manually type this next bit, but it is much quick if you open a File Explorer and navigate to the place where the file or document is. Then click in the File Path section. This will allow you to copy the location perfectly.

Example Location – Desktop — C:\Users\Joshua\Desktop

Once you have copied the location go to the CMD and type the following exactly as is.

cd /d C:\Users\Joshua\Desktop

Hit enter. This directs the CMD to the location you entered. In my case the CMD is now looking at the Desktop.

Now, we need to list everything in that location. We can do that by the following command line.

dir /x

That means show (/x) everything in this directory (dir).

Next you need to find the file. There should be a short name with a ~1 (or another number) next to the file’s long name. This is called the 8.3 filename.

The last thing we need to do is write one more line.

rmdir /q /s EXAMPLE~1

This will remove the empty directory. BOOM!!

delete-ghost-file-windows-8.1

CMD Comman Lines for deleting a Ghost File

Notes from a Youtube User

thnx to Anase Skyrider

Quick Note: The “/q” part of the last command is there to do the deletion quietly and without any “Are you sure?” prompt. The “/s” part of the command is there to tell it to delete the directory even if it has stuff and files inside.

Quick Note2: If you don’t have a short name for the file, try (with the quotation marks) the directory’s actual name. So rmdir /q /s “The Folder Name”

Quick Note3: Use “del” instead of “rmdir” for deleting files (rmdir is for folders).

Quick Note4: If you can’t delete the file still, try renaming it, and use names of varying lengths and with different spacing or spaces. Short names, long names, whatever works to get it to something you can enter in the prompt.

Quick Note5: If even that doesn’t work (which I had to deal with), then go to msconfig (type it into your start menu search bar), turn on safe boot, and reboot. Then try deleting it.

Watch the Video Tutorial

 

Share on Facebook4Tweet about this on TwitterShare on Google+0Pin on Pinterest0Share on StumbleUpon0Share on Reddit0Digg thisFlattr the authorShare on Tumblr2Share on VK

Author: Joshua Casper

Joshua Casper is an Artist, Musician, and Blogger.

Share This Post On
pib-holidays
Hot Plugin Deals!!!