Erase file with too long file name

By lopdog
Apr 15, 2011
Post New Reply
  1. Hi, I have a file that I cannot delete, rename or move, because Windows says it's name is too long or the path is to long (not supported by the file system). The dialog box tells me to rename the file, or move it to another location, but none of this is posible. How can I get rid of this file? (And how is it even posible that the AutoCAD installer and Windows creates a file that the file system cannot handle?)
  2. Tmagic650

    Tmagic650 TS Ambassador Posts: 20,732   +156

    Your PC may be infected with a virus or other malware
  3. gbhall

    gbhall TechSpot Chancellor Posts: 2,333   +49

    as well as virus checkig, also run chkdsk
  4. SNGX1275

    SNGX1275 TS Forces Special Posts: 12,457   +288

    You could try and run a program like Eraser, you may have to tell it to delete on reboot.
  5. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    move all content (except the problem file) in the folder
    backup to the parent folder

    delete the subfolder with the sole problem file in it.
  6. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    NTFS Directory depth limit

    This means
    a) one directory & file name pair can be <=255 characters in length
    b) NN directory names (or a 'path' ) + the longest filename in the last subdir can be <= 255 characters

    I beleive that the '\' path separator is added(or included) to the the total length.
  7. Darth Shiv

    Darth Shiv TechSpot Evangelist Posts: 1,145   +172

    You can delete it from command prompt.
    1) Windows -> Run -> type cmd.exe and hit enter
    2) Navigate to the folder you are after using the "cd" command. E.g. if the directory is:
    you would type
    cd /d c:\this\is\my\folder\path and hit enter.
    Note. the /d means also change current drive as well if applicable so this command works if you have multiple hard drives.
    3) Delete the file by using it's 8 letter dos name. If the file is named SOMEREALLYBIGFILENAME.EXT, the trick is pick the first 6 letters then add "~1" and then the extension.
    So type "del SOMERE~1.EXT" and hit enter. It should confirm the deletion was successful.
  8. lopdog

    lopdog TechSpot Maniac Topic Starter Posts: 378

    Thanks for all the suggestions.

    This is the famous file. It was created by Autodesk AutoCAD, and I don't think it's a virus (unable to scan, no actions is possible with this file). I copied the entire "Application Data" folder from a computer running Windows XP to my external usb hdd, and now I have erased everything again, except this file. Deleting the file using its 8 letter DOS name did not work either. I also tried to use chkdsk, but it found nothing.
  9. lopdog

    lopdog TechSpot Maniac Topic Starter Posts: 378

    OK, I found a solution: I renamed all the parent directories to "1", (eg. C:\1\1\1\1\1\1\1\... etc). That way the file path and name was short enough to erase the file.
    parag60288 likes this.
  10. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    well done - - thanks for the feedback :)
  11. LNCPapa

    LNCPapa TS Special Forces Posts: 4,285   +262

    That must've been one heck of a jpg.
    ravisunny2 likes this.
  12. Smilez33613

    Smilez33613 Newcomer, in training

    I found a so simple way to do it, it really pissed me off, Cut, Paste in recycle bin, empty recycle bin, I had 7 files with over 260 characters long,
    coldheart7 likes this.
  13. coldheart7

    coldheart7 Newcomer, in training

    Thanks a lot. So simple.
  14. learninmypc

    learninmypc TechSpot Evangelist Posts: 5,161   +225

  15. parag60288

    parag60288 TechSpot Member

    It really worked. Now I have relief.
  16. deej78

    deej78 Newcomer, in training

    Easiest way is to open WINRAR archiving software. Navigate to trouble causing files 'folder', right click it and rename it to '1'. If it renames you can then right click and delete.
  17. noemi

    noemi Newcomer, in training

    HAI!! the "1" file name worked I'd grabed a wallpaper archive from konachan and I could not delete the folder renamed both folders to "1" and it worked, heck even ccleaner couldn't delete it neither, but I got it done so thanks y'all

Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...

Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.