10 Replies Latest reply: Nov 3, 2005 1:44 AM by Daniel Macks
Connie Porcher Level 1 (85 points)
I have searched the help files for an answer to this question and haven't found the answer.

Is there a limit to the number of characters that a file name can have? If so, what's the limit?

Thanks for your help!

  • Xeep Level 6 (8,260 points)
    It's something like 255 characters. Essentially, more than you'll ever need.
  • Dean Pahl Level 4 (3,870 points)
    Hi, Connie and Xeep —
    ]Mac OS X: About Long File Names.

    Xeep's right on — for all (OS X) volumes formatted HFS+.
  • Joaquim Lopes Level 4 (3,755 points)
    However, some applications still don't allow more than 32 characters when we save a file. The 255 characters are the system's limit.
  • Courcoul Level 6 (12,996 points)
    Older Carbon or Classic (OS 9) apps won't let you type more than 31 characters. Note that OSX uses the suffix to determine what app opens the document. Also worth noting is that some characters are disallowed in file names, such as : and / which are used to specify directory paths.

  • Connie Porcher Level 1 (85 points)
    I think this must be the issue that I'm running into with Photoshop.

    Thanks to everyone who replied. The error message that I received when trying to save a .jpg file with a long name referred to a "Mac Limit" of characters ... but there's no way the file name was 255 characters in length ... 32, I'll believe.

  • Kurt Lang Level 8 (36,685 points)
    Just as an example of one application, Office X is limited to the 32 characters, while Office 2004 finally took that limitation out. All depends on the application and how it was written.
  • MarkDouma® Level 6 (9,850 points)
    Most parts of OS X are also limited when it comes to the overall length of the file path. The path limitation, "PATH_MAX", is 1,024 bytes, which in most cases means 1,024 characters. (That's based on 1 byte for each character, though Asian characters may require more bytes to represent them).

    Under most circumstances, you won't ever run into this limit, but when you do, you'll get unexpected behavior in the Finder. For example, not being able to move files and folders out of the folder in question.

    Most applications will allow you to use up to 255 characters in the filename, but certain Carbon software that uses the older FSSpecs (a way to refer to a file) will be limited to 31 characters.

    Anyway, hope this helps....
  • Daniel Macks Level 4 (2,285 points)
    slash or colon are disallowed, but not both (techincally; doesn't mean a programmer may have a reason to prohibit both or may do so without understanding that it isn't necessary). Slash is the unix delimiter, colon is the (legacy) Mac one. Mac interfaces automatically map the "legal character" and the "path delimiter" entities correctly. For example, one can create a folder in the Finder named "foo/bar" but not "foo:bar"; the result will be a directory named "foo:bar" for Unixy things.
  • Courcoul Level 6 (12,996 points)
    Another thing that freaks some non-true-Unix apps out is having spaces in the path. Like leaving your startup volume at the default "Macintosh HD" or naming a folder "My Little Secret Folder". Hence it is usually safer to use dashes or underscores in file/folder names, especially if you're working with many different apps.
  • Daniel Macks Level 4 (2,285 points)
    In my experience, it's the true-Unix apps (or Mac apps that spawn shell scripts under-the-hood) that are more likely to mishandle filenames with spaces. The Mac world has always had spaces in filenames and its programmer tools are well aware of that. Spaces are pretty rare in the unix world, though, so it's easy for unix folks to forget to quote them properly. Regardless, it's always a bit of a risk, and much more-so if you're passing files between different apps or different machines.