Deleting files with VERY long file names

Discussion in 'alt.windows7.general' started by Alf, Feb 13, 2011.

  1. Alf

    Alf Guest

    I have picked up a few files with very long names that Windows 7 will not delete (error message indicating that file names are too long). So far I have tried (1) rebooting, (2) moving or changing the
    files names--will not work because I get a Windows error sound by just clicking on the files, and (3) using CMD to try to delete the files with old DOS commands--still get an error message re length
    of the files.

    I would appreciate any suggestions. TIA. --Alf
    Alf, Feb 13, 2011
    1. Advertisements

  2. Alf

    Paul Guest

    The best way to fix it, is to rename the file first, so that
    it uses a shorter name. Then it can be deleted.

    I tested that using the PERL programming language (ActiveState
    PERL is a free download). I was able to create a 259 character
    pathname, which explorer wouldn't delete (threw the kind of error
    you're seeing). By running my script a second time, I was able
    to use the PERL "rename" command, to change the name to something
    shorter. In my testing, it seemed there was one particular
    length that other programs can produce, that Explorer cannot
    delete. I'd say that is a pretty long standing bug, in terms
    of a lack of performance on Microsoft's part. The OS should
    be able to do at least as well, as any other utility can do.

    What it boils down to, is selecting a tool that doesn't use
    the standard way of doing things. And thereby avoiding the

    An example someone suggested in the past was "MP3rename", but
    when you look at some utilities like that, their function and
    interface are pretty far removed from your request for
    a simple tool to delete that file. Using PERL is
    equally far fetched - I used that environment, just to do
    some quick testing, and it wasn't an attempt to write my
    own tool or anything. Just to see "what happens at 259".

    Paul, Feb 13, 2011
    1. Advertisements

  3. Use Unlocker

    Cannot delete folder: It is being used by another person or program
    Cannot delete file: Access is denied
    There has been a sharing violation.
    The source or destination file may be in use.
    The file is in use by another program or user.
    Make sure the disk is not full or write-protected and that the file is not
    currently in use.

    Unlocker can help! Simply right-click the folder or file and select
    Unlocker. If the folder or file is locked, a window listing of lockers will
    appear. Simply click Unlock All and you are done!
    Clog_-_wog (®), Feb 13, 2011
  4. When in DOS or the Command Prompt as Windows 7 calls it did you try
    deleting the file with the long name by using the short name as shown
    with a dir /x while in the directory with the bad file?

    The short name shown with the /x option will be a form of the long name
    but limited to 8 characters.
    GlowingBlueMist, Feb 13, 2011
  5. It's possible tht total folder name + file name is too long? If so, you
    can temporarily try MOVING the folder the file is in to the root or some
    other very short name, deleting or renaming the problem file(s), then
    moving the folder back.
    Andrew Rossmann, Feb 13, 2011
  6. Alf

    Alf Guest

    I didn't try Unlocker (even though I use it) because I had to be able to right click on the file to bring up Unlocker in the context menu and couldn't do that (error sound). I did, however, try
    Unlocker on the folder. When it didn't find anything locked it gave me the option to delete. I tried it and voila! Thanks!

    And thanks to the other posters that responded.

    Alf, Feb 14, 2011
  7. Alf

    R. C. White Guest

    Hi, Alf.

    As suggested by GlowingBlueMist and Andrew Rossman, you can use the Command
    Prompt and those old DOS commands to delete those files.

    First, navigate (CD for Change Directory) to the directory where those files
    reside. If your foldernames are too long for CD to do it in one fell swoop,
    you can CD one level at a time to get there.

    Then remember the /x switch with the Dir command. This lists the SFN (Short
    File Name) for any file whose LFN (Long File Name) does not comply with the
    ancient 8.3 filename rules. (For those reading along, even a
    single-character filename can be an LFN if that single character is one that
    does not comply with the 8.3 rules.) The SFN will be in a column before the
    LFN, but only for LFNs that don't also qualify as SFNs.

    If your folder has too many files to comfortably use dir /x for the whole
    list, then use a wildcard to shorten the list; it should still work. This
    command produces the SFN for both Program Files (PROGRA~1) and Program Files
    (x86) (PROGRA~2) in my Windows folder:
    Dir pro* /x

    Then just use the Del command with the SFN: del PROGRA~1

    If you need to get rid of a folder, rather than a file, remember to use rd
    (Remove Directory) rather than Del.

    As usual in a Command Prompt window, just type any command followed by /? to
    see a mini-Help file listing the switches and parameters available with that

    R. C. White, CPA
    San Marcos, TX

    Microsoft Windows MVP (2002-9/30/10)
    Windows Live Mail Version 2011 (Build 15.4.3508.1109) in Win7 Ultimate x64
    SP1 RC

    "Alf" wrote in message

    I have picked up a few files with very long names that Windows 7 will not
    delete (error message indicating that file names are too long). So far I
    have tried (1) rebooting, (2) moving or changing the
    files names--will not work because I get a Windows error sound by just
    clicking on the files, and (3) using CMD to try to delete the files with old
    DOS commands--still get an error message re length
    of the files.

    I would appreciate any suggestions. TIA. --Alf
    R. C. White, Feb 14, 2011
  8. Anytime, sir!
    Clog_-_wog (®), Feb 14, 2011
  9. Alf

    danielfird Guest

    Alf wrote on 02/13/2011 05:20 ET
    Hi all, I have been suffering from accessing, managing and even renaming file
    that have more than 255 characters over a long time. I have tried various way
    but failed. Then I have searched this problem in internet. Then I have found
    solution. This software is very easy to use. Named Long path Tool. To use th
    program all you need to do is to download this program online and save all th
    settings to your computer. This program is compatible with Windows NT, 2000
    Vista and Windows 7. you can find it from longpathtool(dot)co

    best regard
    danielfird, Mar 8, 2012
  10. Alf

    Jeff Layman Guest

    I have seen this issue with XP. I can't remember how I resolved it, but
    it definitely didn't require a third-party utility. I seem to remember
    that a bigger issue was with CDs or DVDs, which would not accept file
    names longer than 64 characters.
    Jeff Layman, Mar 8, 2012
  11. Alf

    Ken Springer Guest

    Possible workaround, thinking outside of the norm......

    Create a folder in the root directory of a drive. See if you can move
    the files to the new folder. If you can move them, not copy or create a
    shortcut, maybe then you can delete them.


    Mac OS X 10.6.8
    Firefox 10.0.2
    Thunderbird 10.0.2
    LibreOffice 3.5.0 rc3
    Ken Springer, Mar 8, 2012
  12. Alf

    Wolf K Guest

    The issue appears to be the length of the path. I resolved it two ways,
    both tedious, but both successful.

    a) Set Explorer to show the folder tree in the left pane. Rename folders
    from the top down until total filename is short enough. The rename the file.

    b) Use command prompt to navigate through folder levels as above,
    renaming folders as you go.

    I also structured data folder trees to be as a short as possible. Word
    proc programs propose filenames based on the first two or three lines of
    the document. I never accept these, they are always longer than they
    need to be. I suspoect that the files OP "picked up" were docs with such
    file names. Another example of programmers making things too easy for
    the user causing unintended consequences.

    Me too, this limitation still exists, and it's absurd.

    Wolf K.
    Wolf K, Mar 8, 2012
  13. If you get into a command window, you can run the directory command

    dir /X

    this displays the short (i.e., 8.3) filename of the items in the

    You can cd \ to get to the root, then if the folder you want is also
    called (let's say) shorty&1, you can cd shorty&1 to get there.

    One at a time, you can work your way down to the lowest folder and
    delete the file using its short name, such as

    del tiny&1

    You may be able to get to the directory in question in a command window
    more directly. In Windows Explorer, Shift-Right Click the folder name
    and choose "Open command window here".

    Note: I *think* that's a standard Windows thing, but maybe I have an
    add-on to do it. In that case Shift-Right Click is not good advice.
    Gene E. Bloch, Mar 8, 2012
  14. Alf

    Rob Guest

    Use Unlocker - Google it. This will allow you to delete the files.
    Rob, Mar 8, 2012
  15. Alf

    Bob I Guest

    Another method is to map a drive letter to a folder just above the
    problem file. To do this share the folder to everyone and then map the
    folder as a network share. Disconnect the drive when done and remove
    sharing permission. Saves a lot of messing about with renaming
    Bob I, Mar 9, 2012
  16. Alf

    Stan Brown Guest

    Really not necessary, though I'm glad it worked for you.

    Find the folder in question in Explorer, Shift-Right-click and select
    Open Command Prompt here. Type "dir /x" (no quotes) to reveal the
    short file names next to the long file names. Then "del" (no quotes)
    and the short file name.
    Stan Brown, Mar 9, 2012
  17. Alf

    dweebken Guest

    Try the PathTooLongTool... from
    It's free to try or $19 to buy.
    It finds long paths as well as gives you the option to copy or delete
    the files.
    dweebken, Mar 9, 2012
  18. Alf

    Joerg Jaeger Guest

    That seems to work well. I think you can most likely solve most problems
    with the shell.
    Just like in Linux.
    From what i tried it looks like Windows names the first 6 letters, then
    a ~ and a counting number with extension.


    ____/ o o \
    /~____ =ø= /
    (______)__m_m) el cato
    Joerg Jaeger, Mar 9, 2012
  19. Yes, that's correct or close to correct, AFAIK. Still, the safest thing
    is to use dir /x in a command window, so as not to accidentally use the
    wrong name. Dir /x shows both names, which makes correct identification
    Gene E. Bloch, Mar 9, 2012
  20. []
    Does SUBST no longer work in 7? (It works in XP; I think XP tries to
    dissuade you from using it, but I haven't experienced any ill-effects,
    provided you know you're using it.)

    Mapping drive letters - and SUBST if available - are (possible)
    solutions to the problem of too long a name including the path; if the
    path is not involved, then use of the short name is better.
    J. P. Gilliver (John), Mar 9, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.