I cannot delete a 0 byte file

Fri, 06/04/2010 - 12:26 — Tom

Problem: You have a file on your disk. You have deleted it, but it still is there, and saying it takes 0 bytes. If you delete it, Windows tell you that "Could not find this item. This is no longer located in … Verify the item's location and try again."


Solution: Open the command line and navigate to this folder. The fastest way to do this is to hold down shift and right-click on the folder containing the file. Choose "Open command window here…"

In the command line, write "dir /x". This will show the old DOS name of your files, which is the file's first 6 non-space letters, then a '~' and a number. This is the file's real name.

To delete it, write "del FILENA~1" and replace FILENA~1 with your file's real name.

Why: The file has for some reason got a filename which Windows is unable to parse. In my case I got a file which had a space at the end of the filename, which should be impossible to do. Windows folders can read files with space at the end, but Windows' delete-function cannot locate files which end with a space.