I was programming in Python and accidentally passed the contents instead of the filename to open() and I have been left with a file called "  being lazy " (with leading and trailing spaces) which can not be deleted.

When I try to delete the file, I get this error:

Could not find this item
This is no longer located in [system path]\essays. Verify the item's location and try again

I am Error

I can not delete the folder it is in. I have restarted the computer.
I try to delete it with the Command Prompt, does not work:

enter image description here

If I try to open it with Notepad, nothing happens. If I try and open it with Notepad++, it says it does not exist.

  • 1
    In the command line, try del *lazy*. – Aaron Miller Apr 17 '13 at 19:48
  • 9
    Boot into a live Linux Env and delete the file. – Ramhound Apr 17 '13 at 19:49
  • 2
    It's completely retarded that this breaks with the Explorer GUI, which should read the bit-exact, correct name from the operating system, keep it internally that way regardless of how it is displayed, and pass it back to the OS in a subsequent call. – Kaz Apr 17 '13 at 20:54
  • This happened once when I created a file on Linux which was above the length Windows allowed on an NTFS partition, so it could not read/write/delete it, but it showed in the directory, just as in this case... – jadkik94 Apr 19 '13 at 18:47

In the command line, try del *lazy*.

| improve this answer | |
  • 10
    note that this will delete all files with "lazy" in the title. One way to target the file more specifically is to find the "short form" name: dir /x and then use the short form name with del – horatio Apr 17 '13 at 20:51
  • 2
    Hard to believe that the del command has more robust handling of file names than exporer.exe. – Kaz Apr 17 '13 at 20:55
  • 1
    @horatio: Since there's only one file in the directory with 'lazy' in the name, I didn't see the harm. As with any shell command from the Internet, one executes it on one's own machine at one's own risk. – Aaron Miller Apr 17 '13 at 22:31
  • 1
    Of course. My comment was meant as an expansion of your answer. – horatio Apr 18 '13 at 16:14
  • 1
    @horatio I think you should post it as a separate answer. – jakub.g Apr 18 '13 at 19:24

Much like Ramhound suggested, you will need to build a Knoppix CD or some sort of Live Linux CD, then boot your machine with the Live CD that the file is on. Next browse the drive that the file and folder is on and delete the file or folder you want to delete, that should do the trick.

I hope this helps out, the main reason you can't delete the file is because it is open or locked in memory, but if you boot the machine with a live CD that will work around the problem.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.