Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

terrybell

macrumors newbie
Original poster
Mar 16, 2009
1
0
I am trying to work out the most efficient way to generate a series of empty nested folders in OS X.

I figure there must be a terminal command to do this, but I am a bit of a terminal n00b.

Also what is there a limit of how many nested folders OS X can support?

Thanks,

TB
 

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
If you use the mkdir command with the -p option, it will create intermediate folders. For example mkdir -p ~/temp01/temp02/temp03 will create a temp03 folder inside a temp02 folder inside a temp01 folder inside your home folder.

EDIT: oops, forgot the flag in my example...fixed.
 

autorelease

macrumors regular
Oct 13, 2008
144
0
Achewood, CA
As far as I know there is no limit on the number of directories that can be nested. However, the longest an absolute path can be is 1024 characters (or whatever the value of PATH_MAX is). You'll probably start getting "file name too long" errors somewhere around the high hundreds of nested directories, depending on the lengths of their names.

And yes, mkdir -p is the answer. Manpages are your friend.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.