Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Nesting Folders Limit

I'm working on a project for our publishing company/record label (Fallt: http://www.fallt.com) on the Macintosh OS and need to find a human being at Apple (anyone, but if possible someone who knows the OS well from a technical point of view) or someone with an in depth knowledge of the finer points of OS X.

I've tried the Apple Help site, but it's a little Kafka'esque and there's no way to contact a 'real' human being!

The project is for a sculpture we're working on which uses Apple's OS as a key feature and we need to ask some technical questions. Specifically what the maximum number of folders it's possible to nest inside one another is (on both OS 9 and OS X).

I'd really appreciate if anyone can help. Feel free to email me off list chris [at] fallt [dot] com

MacBook Pro, Mac OS X (10.4.10), N/A

Posted on Sep 29, 2007 8:58 AM

Reply
12 replies

Sep 29, 2007 12:34 PM in response to Fehler

Dear All,

Many thanks for all the pointers so far, very much appreciated. We're not so much interested in how many folders we can put inside one folder, i.e. at the same level, but more in how many folders we can nest. The project is called 'untitled folder' ( http://www.fallt.com/untitledfolder) and is about the creation of a data structure as a 'sculpture'. (Cf. Brancusi's 'Endless Column': http://en.wikipedia.org/wiki/TheEndlessColumn)

Charles, you wrote, "I don't know of a limit to the number of nested folders, but the maximum path length of OS X is 1024 bytes."

All of our folders will be called:

untitled folder

i.e. 15 characters long. How many 15 character long folders can we nest if a maximum path length of OS X is 1024 bytes?

It will look like this:

untitled folder/untitled folder/untitled folder/untitled folder...

We wrote an AppleScript to try and nest 32,767 folders called 'untitled folder', however, after several days we were forced to reboot our machine!

Many thanks for your help!

Sep 29, 2007 3:12 PM in response to Fehler

Consider posting this to one of the developer forums.

Charles, you wrote, "I don't know of a limit to the number of nested folders, but the maximum path length of OS X is 1024 bytes."


I read somewhere apple increased this size in 10.4. Anyway, as you navigate down the folder hierarchy you can avoid entering the full path name. This may avoid the 1024 limit.



We wrote an AppleScript to try and nest 32,767 folders called 'untitled folder', however, after several days we were forced to reboot our machine!


My guess is the number would be large since a folder is just a special case of a file in Unix. I do not know if this would be try in Mac OS when using the HFS+J file system.

What was on the disk when you stopped?

You should be able to look at the disk as the applescript is running.

Start with a smaller number and try that and stop and see what is shown. In crease number and look again.

Robert

Message was edited by: rccharles

Sep 29, 2007 5:58 PM in response to rccharles

rccharles wrote:
I read somewhere apple increased this size in 10.4. Anyway, as you navigate down the folder hierarchy you can avoid entering the full path name. This may avoid the 1024 limit.


getconf still reports it as 1024 on HFS+ volumes (in your home directory in Terminal):

<pre class="command">getconf PATH_MAX .</pre>

Start with a smaller number and try that and stop and see what is shown. In crease number and look again.



By my count, I get 64 folders if it's at the root of the boot drive:

1024 / 16 (don't forget the "/" divider) = 64

It would be somewhat less if you were on an external drive, as those are mounted in /Volumes.

You might be able to get by with longer paths in some circumstances, but whether or not the extra folders are visible will depend on what program you're using to look at them.

Jonathan "Wolf" Rentzsch has an article on this, including some notes on which apps will choke on the long paths and which won't.

charlie

Sep 30, 2007 10:44 AM in response to Fehler

Dear All,

Again, thanks for everyone's energetic help. We've now ascertained that it's possible to nest far more than the 1024 bytes pathname limit (or the 64 folders Charles suggests) above. We've been able to nest hundreds of folders, but when we try to archive the folder or zip it, we get an error. We also cannot upload it via FTP to our server, again an error.

Someone at Apple must know the answer to this question. If anyone else has any further ideas we'd welcome your input!

Conceptually it must be possible to work out the maximum possible pathname limit.

Sep 30, 2007 7:38 PM in response to Fehler

I would strongly advise against going past the 1024 byte limit in the total file path length. If you really want to, do it on a volume where you don't have important data in case you need to erase it.

I did the same thing you did a while back, out of curiosity, where I wrote an AppleScript to repeatedly created nested "untitled folders". Yes, you can perhaps create more than 64 nested folders, but any folders which occur beyond the 1024 byte limit will become inaccessible. I remember trying to drag the 66th or 67th folder up higher in the chain, and got the "prohibited" symbol, meaning the Finder couldn't perform the operation.

It appears that the maximum recommended folder depth is 100 (obviously, this assumes much shorter names for the folders): http://www.macfixitforums.com/showflat.php?Cat=&Board=tiger&Number=831407&page=0 &view=collapsed&sb=5&o=31&fpart=1

Also see Technical Note TN1150 HFS Plus Volume Format

Hope this helps....

Sep 30, 2007 8:29 PM in response to Fehler

I'd suspect that the filesystem lets you have as many nested folders as you want.
At the Unix layer, you can:
mkdir newfolder
cd newfolder
mkdir newfolder
etc.
You don't run into the limit here.


I assume the problem comes when you want to access the files or folders. When you run up against the 1024 limit then you have a problem.


"Update: Turns out you can navigate to the blackhole folder in zsh (cd ~/Desktop/aaaa /bbbb*/cccc*/dddd*/eeee) and tcsh (cd ~/Desktop/aaaa /bbbb*/cccc;cd dddd /eeee). That's great news, that means the PATH_MAX brokenness isn't in the BSD layer, it's "just" in sh, bash, Core Founation and/or Cocoa. While I doubt sh or bash will be fixed, it's quite possible that Apple would fix Cocoa. Radar 4262085. Credit to Peter da Silva for pointing this out."
http://rentzsch.com/macosx/pathmaxBlackholing

Sep 30, 2007 9:00 PM in response to Fehler

Just a warning in case people start playing around with creating a lot of folders -- be aware that there is a bug somewhere so that if you fill up the last remaining space on an HFS+ volume with empty folders, that space seems to be lost permanently, even after deleting the folders. In an extreme case, you can end up with an empty drive that has no remaining space. The effect is not "permanent" as in "bricking", but permanent as in needing to reformat, as far as I can tell without 3rd party software at least. The strange thing is that ' fsck' / "Disk Utility" don't recognize this as damage.

I did report this as a bug about a year ago, but figured it wasn't a big deal in "real life", except maybe for "FileVault" users. But if people start creating large numbers of folders looking for a hard limit... well, you have been warned.

Nesting Folders Limit

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.