Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 2 files from internet saved pages that have an extremely long name in my external HD. I can't delete those. I tried schedule deletion on boot but it didn't work. Any idea?

share|improve this question
add comment

2 Answers

A simple way to delete files you can't reach using their filename is to move everything else out of the directory to a temp directory (obs: not a sub-directory of the problematic one) and remove the directory itself (using rmdir dirname not del .). After you can re-create the directory and move the files back. Be sure to move the hidden files away too.

If you need more help, please give us more info like:

  • Which OS are you using?
  • The message is "file not found" or similar or the files are not deletable?
  • What are the filenames? Possibly there are unallowed (or hidden) chars in the filenames.
  • Diid you try to rename the files?
share|improve this answer
    
I think this is unlikely to work if the problem is either that some of the paths are too long or if any of the names contain illegal characters. To delete the directory, you have to recurse to delete everything inside it, meaning you still have to traverse the tree and you will still hit that problematic pathname and fail. The solution for developers is to use Microsoft's long Unicode filename format, but apps that support it are rare because it's new and a lot of work. A different strategy in some cases is to cd deep into the directory tree to delete the leaves, then work your way up. –  Nicole Hamilton Nov 17 '12 at 18:28
    
This works well on XP I did it many times (a long time ago, that's true...). Using wildcards to remove the files doesn't work but removing the entire directory with rmdir directoryname works (I will update giving the command as it is true, del doesn't work. –  laurent Nov 17 '12 at 19:19
    
+1 I agree, now that you've clarified your answer to use rmdir. I just tested and can confirm that the rmdir /S dirname command inside cmd.exe does support long Unicode names, at least on Win7, where I tested. –  Nicole Hamilton Nov 17 '12 at 19:44
add comment

I presume you're on Windows. The rm utility included with my Hamilton C shell supports Microsoft's new long Unicode names internally and should be able to delete anything. This sounds like a one-time problem, so don't buy it, just use the free version. Full disclosure: I'm the author.

share|improve this answer
add comment

protected by slhck Feb 21 '13 at 7:23

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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