0

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?

1

2 Answers 2

1

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.

1

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?
3
  • 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. Nov 17, 2012 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, 2012 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. Nov 17, 2012 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .