
Ask HN: How many levels deep is the deepest directory on the average PC? - ReedJessen
Files are typically arranged in hierarchical structures.  An example might be:<p>Home -&gt; User -&gt; programs -&gt; Hello_World -&gt; bin -&gt; run.exe<p>Home -&gt; User -&gt; programs -&gt; Hello_World -&gt; readme.txt<p>When we think about all the libraries and nested files required to run the average computer, my gut feeling is that one my descend deep down the rabbit hole to get down to the most core file of computing.<p>Is the total number of hierarchies between the top level and the bottom level an easily measurable thing?  Does this number have significant impact on efficiency or on some other parameter important to the computers function? Does this number differ significantly from architecture to architecture (MacOS to Windows for example)?
======
viraptor
> Is the total number of hierarchies between the top level and the bottom
> level an easily measurable thing?

Sure. Just check all the files on your disk.

> Does this number have significant impact on efficiency or on some other
> parameter important to the computers function?

Not once the file is accessed and all the relevant structures are cached.
Actually on some filesystems it's beneficial to split directories with lots of
files (think millions) into deeper hierarchies. You can sometimes see this
bubbling up to the visible layer on some file hosting sites. You get a url
that looks like example.com/file/so/me/somehash (first characters of the hash
are used for the hierarchy split)

~~~
jf
Here is how I'm trying to measure this on my system:

    
    
      (for d in `find / -type d | sed 's/[^\/]//g'`; do echo $d | wc -c; done) | sort -n
    

Edit: It looks like the deepest directory on my (Mac OS X) system is 27
directories deep.

~~~
ReedJessen
So cool. Thanks.

------
jeffmould
It's been a while since I last checked, but if I remember correctly, Windows
has a 255 character path limit.

~~~
new_hackers
yes, AFAIK this is still true today

~~~
jf
For the curious, this page contains a helpful comparison maximum pathname
lengths of various filesystems:
[https://en.wikipedia.org/wiki/Comparison_of_file_systems](https://en.wikipedia.org/wiki/Comparison_of_file_systems)

