Timeline for Does OS X enforce a maximum filename length or character restriction?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 8, 2021 at 9:37 | comment | added | Paul Stelian | @AlexGrafe I managed to make 8 nested directories with that path name. PATH_MAX is only encountered when giving absolute paths to system calls, when you give relative directories the full path length seems to be unlimited. Big Sur, APFS. | |
Jan 5, 2018 at 17:27 | comment | added | AlexGrafe |
I tested the following: touch 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 works fine. But touch 12345678901234567890....6 with one more character throws: File name too long . FYI touch just creates an empty file, or actually sets the existing file's time_modified to now.
|
|
Mar 24, 2013 at 21:38 | comment | added | bmike♦ |
@PercivalUlysses Yes - on Mountain Lion I was able to make a directory path 1037 characters deep and plop a file and spotlight, finder aren't happy to navigate to, locate or open that file in Text Edit until I move it up one folder (where the path is 996 long) and everything works as expected. Also pathchk -p is handy for running these sort of portability checks.
|
|
Mar 24, 2013 at 21:22 | comment | added | Percival Ulysses |
@bmike Yeah :) Do you know anything about this 1024 character limit for paths? On 10.6, this behaviour is documented in the system header files, and there is PATH_MAX variable. Still so on later systems?
|
|
Mar 24, 2013 at 21:13 | comment | added | bmike♦ |
@PercivalUlysses You are correct : is forbidden on HFS and HFS+ but most UNIX folk are used to automagic substitution of / for : and vice versa and don't realize HFS's internal storage uses : to separate directories from file names.
|
|
Mar 24, 2013 at 21:11 | comment | added | Percival Ulysses |
That with the / is not true (10.6 here). What you can't use is : (old HFS separator), at least in the Finder. Funny thing is that / is represented as : at the shell level. Another strange limitation is that the path length is limited by 1024 bytes or UTF-8 chars, not sure which. This isn't enforced by Finder and can lead to strange behaviour.
|
|
Mar 24, 2013 at 21:05 | history | answered | MattDMo | CC BY-SA 3.0 |