How to find depth of a directory
How to get the depth of the deepest file in the directory structure of your software projects
If for whatever reason you want to find how deep a directory tree goes in your software projects, simply run this nifty little one liner
find . | grep -v "\.git" | awk '{print gsub(/\//,"")}' - | sort -r | head -1This will first run a find on the current directory, filter git files, find the number of “/” per line, reverse sort them and finally show the highest depth.
(This was originally published on my now defunct blog etl.svbtle.com)