1. TechSpot is dedicated to computer enthusiasts and power users. Ask a question and give support. Join the community here.
    TechSpot is dedicated to computer enthusiasts and power users.
    Ask a question and give support.
    Join the community here, it only takes a minute.
    Dismiss Notice

Erase file with too long file name

By lopdog ยท 18 replies
Apr 15, 2011
  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: 17,244   +234

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

    gbhall TechSpot Chancellor Posts: 2,431   +77

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

    SNGX1275 TS Forces Special Posts: 10,729   +409

    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: 10,432   +801

    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: 10,432   +801

    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 TS Evangelist Posts: 1,763   +435

    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 TS Maniac Topic Starter Posts: 295

    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 TS Maniac Topic Starter Posts: 295

    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: 10,432   +801

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

    LNCPapa TS Special Forces Posts: 4,247   +448

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

    Smilez33613 TS Rookie

    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 TS Rookie

    Thanks a lot. So simple.
  14. learninmypc

    learninmypc TS Evangelist Posts: 7,290   +372

  15. parag60288

    parag60288 TS Member

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

    deej78 TS Rookie

    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 TS Rookie

    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
  18. D Chamberlain

    D Chamberlain TS Rookie

    lol..I just cut and pasted it like you said and Voila! I did have to make one more step, move from "Music" to "Public Music" folder to do it though. Great suggestion! :O)
  19. Steven Shaffer

    Steven Shaffer TS Rookie

    Thanks deej78! Worked like a charm. I wasn't able to delete, move or anything. So I'm not sure how others are doing that stuff. Windows wouldn't even give me an option to copy/cut or move. I even tried just dragging the file to the recycle bin and Windows said NO!
    Markos illona likes this.
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...