On Tue, 29 Jul 2008 11:33:16 +0530
"Anupam Jain" <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> Does anyone know of a way to get the maximum directory nesting,
> starting from the specified base, using standard Linux commands only
> (no php/perl/python etc.)?
> 
> e.g. if the directory structure is as follows -
> d1
> ->d2
> ->->d3
> ->->->d4
> ->d5
> ->->d6
> 
> I need a shell script which will give me the answer "4" (i.e. depth of
> the deepest directory - d4).

  find . -printf '%d\n' | sort -n  | tail -1

will give you this answer for the current working directory. Replace '.'
with the desired directory name.

Regards,
Gora

_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to