[Gllug] counting subdirectories

Pete Ryland pdr at accucard.com
Tue Oct 14 14:39:21 UTC 2003


On Tue, Oct 14, 2003 at 03:39:44PM +0100, stanley wrote:
> Hopefully this will be an easy one for most,
> 	For my university coursework I have been asked to create an alias that will
> count and display the number of subdirectories in one directory, and so far
> the best I have managed is
> 
> alias dc="ls -1aF | grep "/" | wc -l"
> 
> this work but also includes the parent and root directories in the count.
> Anyone with any tips.
> TIA

Try looking at the -type predicate to the find command.

Pete

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list