Unable to Delete Files -- File Name Too Long

Anonymous
2010-05-01T23:10:08+00:00

I copied all of the files under C:\Users<userid> to a backup drive (NTFS).  I then tried to delete the Temporary Internet Files folder.  I go an error message saying:

The file name(s) would be too long for the destination folder.  You can shorten the file name and try again, or try a location that has a shorter path.

When I drilled down to where the problem files were I saw a bunch of files with very long names.  I right clicked on one (hoping to rename it) and the only options available were: Open, Pin to Start Menu, Send to.  Delete, Rename and Properties were missing.

How do I get rid of these files without having to reformat the drive?

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2010-05-03T07:03:50+00:00

For those that hit the same problem the solution was to open the folder in a cmd window and list the short names of the files.  Then use the short names with the Erase command.

Was this answer helpful?

100+ people found this answer helpful.
0 comments No comments
Answer accepted by question author
Anonymous
2010-05-02T00:13:20+00:00

Hi,

Try Disk Cleanup = Start - All Programs - Accessories - System Tools - Disk Cleanup


You may also need to run checkdisk

How to Run Disk Check in Windows 7

http://www.sevenforums.com/tutorials/433-disk-check.html

======================

If needed :

DO NOT INSTALL THE eBay Option with UnLocker (uncheck it in the installer) andthen go into UnLocker Folder in Program Files - UnLocker and DELETE the ebayxxx.exe file - you can easily see it."C:\Program Files\Unlocker"  just the ebayxxxx.exe I forget its name exactly.

Author's site shows it as Vista/Windows 7 supported now :

http://www.emptyloop.com/unlocker/ 

UnLocker 1.92

http://www.softpedia.com/get/System/System-Miscellaneous/Unlocker.shtml <-- or Download UnLocker here ****

Download - SAVE - go to where you put it - Right Click on - RUN AS ADMIN

The below also works on 32 and 64 bit Vista/Win 7 and should work on Win 8/8.1.

Another good alternative - Use FileAssassin :

FileAssassin - Free

http://www.malwarebytes.org/fileassassin.php

Force Delete (Cannot Delete) Locked or In Used Files or Folders with FileASSASSIN

http://www.mydigitallife.info/2008/12/27/force-delete-cannot-delete-locked-or-in-used-files-or-folders-with-fileassassin/

Download - SAVE - go to where you put it - Right Click on - RUN AS ADMIN

And this - MoveOnBoot

MoveOnBoot

http://www.softwarepatch.com/software/moveonboot.html

Hope this helps.


Rob Brown - MS MVP - Windows Desktop Experience : Bicycle - Mark Twain said it right.

Was this answer helpful?

20+ people found this answer helpful.
0 comments No comments

84 additional answers

Sort by: Oldest
  1. Anonymous
    2013-03-31T11:31:10+00:00

    Anytime I have a problem file or folder, I just drag it to the desktop and hit the delete key or whatever.  It works every time.  When I had this problem described above, it worked like a charm, must rename the file when moved.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-04-25T08:23:46+00:00

    If you are running Windows 7 then you should do a heck of a lot more than that!

    You should write a formal letter of complaint and initiate a class action lawsuit against Microsoft for putting your personal property at severe risk because the file system is no longer working.

    I read through some of these comments and someone said "ya, some of the file names were pretty long but ..." and it made me wonder how, if the lengths had exceeded the OS's limitation, these file names could be characterized as merely "pretty long". The maximum length of a file's full path name in Windows 7 (in fact any NTFS file system) is 32,767 characters. Let me repeat that:

    The maximum path length under Windows 7 is 32,767 characters.

    Now if you were listing that in a cmd box, which is an 80x25 character box, then a file path exceeding that length would have to scroll through at least 16 pages (2000 characters per page) to be listed. That's SIXTEEN PAGES to list just one file name. "Pretty long" ? Eh?

    I've found, personally, that when I've run into file length errors like this, and then I go list the contents of the offending directory, the file paths never fill up more than 2 or 3 lines in the cmd box. That's at most 80*3 characters, or 240 characters. Guess what the value of MAX_PATH was for good 'ol DOS?

    Answer: It was 260 characters.

    Now it doesn't take a genius to realize that the latest and greatest NTFS file system code "under the hood" in Windows 7 is limiting path lengths (under certain circumstances of course) to the old MAX_PATH from DOS (remember DOS?).

    The errors come up all the time:

    File copy

    File recycle

    File restoration from previous version

    are 3 examples where I've seen the error come up. The last occurrence was less than 2 days ago.

    One more thing:

    A crucial component of the file system, a system call named "GetFileAttributes", fails under Windows 7. It works on XP/NTFS and Windows 2000 Server NTFS. Many programs use this function (mine as well) to determine a file's existence or if it's a directory and so on. Most code (including my own until recently) simply assume that the function succeeds and is reporting correct information and don't even bother checking for "system failure" (what else are you going to do?).

    So, like ... for example, it fails and you're checking if a file you need exists (like an ini file). Ok, so the file doesn't exist and you go ahead and create a new one. But the "failure" was not, as one would have assumed, due to the file not existing! You have to go and check the system's internal error code to find out that it was the function itself that failed to determine the file's existence.

    Ever wonder why your files are always getting wiped out for no apparent reason?


    EDITED TO ADD:****Well now the function is working again. So it seems intermittent. Unfortunately I can't reproduce the bug to find out what was going on. I know GetFileAttributes was failing while another function (FindFirstFile) was working, both on the same directory. Now they are both working again.

    • Alan

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-05-14T10:44:10+00:00

    "Unlocker" free download worked for me after trying everything else.

    Was this answer helpful?

    0 comments No comments