file name and directory name length

Discussion in 'Mac Basics and Help' started by larry5925, May 13, 2019.

  1. larry5925 macrumors newbie

    Joined:
    May 13, 2019
    Location:
    South West Ohio
    #1
    Is there a file name and directory name length limit? Using Mac 10.14.4
     
  2. DeltaMac macrumors G3

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #2
    wikipedia says that file name and directory path name size limits should be the same between the older HFS Plus, and the current APFS used in Mojave.
    So, about 255 characters for a file name, and a path name has no practical limit.
    However, some apps may have built-in limits for file names and path names - it's just not a limitation of the file system itself. More often, you might run into problems when using special characters, but that's just something that you watch out for as a normal user of a computer.
     
  3. larry5925 thread starter macrumors newbie

    Joined:
    May 13, 2019
    Location:
    South West Ohio
    #3
    I'm having problems opening microsoft word 16.24 documents that are in the 11th level of sub folders with long sub directory names and file names.
     
  4. NoBoMac macrumors 68020

    NoBoMac

    Joined:
    Jul 1, 2014
    #4
    This.

    Safe guess, if a limit, probably 1024 or 2048 characters.
    --- Post Merged, May 13, 2019 ---
    Office has a limit of 259

    https://support.microsoft.com/en-us...sages-when-you-try-to-open-an-office-document

     
  5. DeltaMac macrumors G3

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #5
    If that 1024 is accurate, that's a lot of characters for a pathname. Even with only 11 levels, you would have to average about 90 characters per level to approach that.
    You MIGHT want to look for special characters, not just alphanumeric.

    Are those documents on a local drive, or are you downloading those through a net drive, or downloading from a remote server? If the documents are local, can you try moving the files up a few levels, at least as a test?

    Ah, and I see that NoBoMac reports a much lower limit from Microsoft, which would now make sense.
    If you are using Excel, the limit is even lower, Microsoft says 218 total characters for Excel files. Microsoft also points out that
    hmm... Excel files would only get an average of 20 characters per level. If somebody gets crazy with folder names, then there you are.
     
  6. larry5925 thread starter macrumors newbie

    Joined:
    May 13, 2019
    Location:
    South West Ohio
    #6
    Local 8.0 Lacie Drive. if the file itself is moved to the Desktop, the file opens as expected.
     
  7. NoBoMac, May 13, 2019
    Last edited: May 13, 2019

    NoBoMac macrumors 68020

    NoBoMac

    Joined:
    Jul 1, 2014
    #7
    It works because you have now changed the length of the pathname to the file to something under 259 characters.

    For example, if I have a Word document on an external drive, the pathname might be something like this.

    /Volumes/MyDrive/MyWorkDocs/2019/05/Work1/Sub2/Sub3/myworkdocument02.docx

    That's 73 characters (yes, example is less than 259: Too lazy to make a >= 259 path).

    Move to your Documents folder, now you have something like

    /Users/myuseridhere/Documents/myworkdocument02.docx

    That's now down to 51 characters.

    So, if crazy deep with long folder and document names, probably butting up on Office's size limits, and when moved to local drive, truncated a bunch of characters from the pathname. Ie. going from > 259 characters (which Office cannot do) to about 50-70 (which Office can do).
     
  8. larry5925 thread starter macrumors newbie

    Joined:
    May 13, 2019
    Location:
    South West Ohio
    #8
    Now to revise the whole file system. Big OUCH!!!
     
  9. DeltaMac macrumors G3

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #9
    That would only be needed for the documents that you expect to use in Office. Possible that other apps wouldn't really need that manipulation.
     
  10. larry5925 thread starter macrumors newbie

    Joined:
    May 13, 2019
    Location:
    South West Ohio
    #10
    I agree, only Microsoft Office products files need to be re-organized
     
  11. jamietshaw macrumors member

    Joined:
    Sep 25, 2009
    Location:
    UK
    #11
    Limitations are on the number of bytes rather than characters. Normally they are the same thing but special characters can use up more than one byte. For example, the emoji heart symbol ❤️ is 3 bytes. On the command line I was able to create a file of 255 bytes but no more.
     
  12. DeltaMac macrumors G3

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #12
    Hmm...
    I would hope you are NOT using multi-byte characters or emoji in file or folder names. I bet those would be the first that are disallowed by some apps.
     
  13. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    Location:
    betwixt
    #13
    That's a limit of HFS+:
    https://en.wikipedia.org/wiki/HFS_Plus

    Specifically, 255 UTF-16 encoding units, normalized to an Apple-modified variant of Unicode Normalization Format D, which decomposes accents from their base characters.
     

Share This Page

12 May 13, 2019