public int dirDepth ( final File path ) { final String stringPath = path . getPath ( ) ; return stringPath . length ( ) - stringPath . replaceAll ( "[/\\\\]" , "" ) . length ( ) ; }
Counts the number of directories in a given path .