Cannot delete file: filename too long
Sometime ago, I made a copy of a hierarchy of folders under my "Users" folder to another drive as a quick backup. I no longer need this copy of folders and files. So when I tried to delete these files I got a message that some filenames are too long. When I look at these files they mostly seem to be part of Internet Explorer temp directory, and also some files used by Mozilla Thunderbird, so they were likely created by these utilities on purpose. I cannot rename them to shorter names, or even move them to lower folders. I can't even copy their filenames to show you what these filenames are! When I use the DOS prompt's "dir /x" command these files do not even have any 8.3 short filenames either, which I could've used to delete them with. There are over 400 of these files! I know what the problem is, the Windows OS has a limit of somewhere around 250 characters for filenames and complete pathnames. I've seen some utilities advertised saying that they can delete these files, but they all require money. Anything that's free?Yousuf Khan
May 14th, 2011 2:37am

Looks like no one has an answer to this one. Well I tried something really desperate yesterday. I decided to boot into Linux and mount this Windows disk under it. That did the trick, all I had to do is mount the disk, and then navigate to the folder hierarchy which I wanted removed. Just right-click it in the Linux file explorer, and tell it to delete. It took a split second and it was gone. It was in fact faster than when I tried deleting it under Windows, because under Windows it seemed to go and find each individual file and delete each one. In Linux, it simply deleted the base folder and everything was gone underneath. Yousuf Khan
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2011 4:50pm

Hi, How about holding Shift + Delete? Google for MoveOnBoot. MoveOnBoot will only removes files and not directories though. Best Regards, L.S
May 17th, 2011 1:20am

Hi, How about holding Shift + Delete? Google for MoveOnBoot. MoveOnBoot will only removes files and not directories though. Best Regards, L.S Why is shift-delete different?Yousuf Khan
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 2:41am

Hi, It is just for testing. It is good since the files can be deleted in Linux. However, if you don't have Linux, it needs to find the way to delete the files under Windows. Since the files are located in Internet Explorer temp directory, you could use Disk Cleanup to clear the Temporary Internet Files. Also, check if the following KB is helpful. It has several methods. Go to check if 8.3 name creation is disabled. http://support.microsoft.com/default.aspx?scid=kb;en-us;320081 Best Regards, L.S Regarding it being in the Internet Explorer temp directory, it actually wasn't. Remember I said in the original posting that this was in a backup directory of these directories, so Disk Cleanup has no way of knowing that this belongs to Internet Explorer or anything else. Also there was a Thunderbird directory having the same issues as well, which Disk Cleanup wouldn't have touched no matter what. Okay, I checked out the state of the filesystem registry. The "NtfsDisable8dot3NameCreation" entry in the "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" is set to non-zero, meaning the feature is in effect. Interestingly it was set to 2 rather than 1, but I doubt that makes a difference. Even if I disable this feature right now, all previously created files still won't be assigned the 8.3 filenames, just only those files that are newly created will have the 8.3 filenames available.Yousuf Khan
May 19th, 2011 12:53am

I had a similar problem with file name "too long" on Win XP. With code that walked through every directory tree and making changes to each file and the new saved to a different location. All was fine until a saved location was specified as sub directory under the source directory. It recursively made empty sub directories, ~2800. After searching for several hours and trying everything mentioned could not delete them. Even after opening the dual boot to Ubuntu 11.04 and accessing that directory under "host" it could not delete the directory. I had to write some code to walk the directory and after so many then rename the next which "moved" all subsequent subs, which didn't actually move anything on the hard drive but just the index of where it is at, like the FAT table or however that is done in NTSF. Then the few that were left in the source directory could be deleted. I had to tinker with the number left so it was not "too long" and throw the same error. That had to be done over and over until they could all be deleted.
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2011 7:57am

I would have tried to emacs the directory and pressed 'd' and I think 'x' to expunge. Or use the cygwin unix commands for windows.
June 16th, 2011 1:57pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics