[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: listing number of directories only

Once upon a time Lance Hoffmeyer said...
> find -maxdepth 1 -type d | cat -n
> but these two methods list all the hidden directories as well,
> .news, .mozilla ...
> I tried du --max-depth=1 --exclude '\.*' but it excluded everything
> (Guess it treated it as .*).
> How can I list only non-hidden subdirectories in a directory?

You almost had it with find(1):

$ find -maxdepth 1 -type d ! -name '.*' | cat -n

although if you want a count, 'wc -l' would be better than 'cat -n'

Reply to: