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

Re: number of files in directory?

Once upon a time Lance Hoffmeyer said...
> How can I get a count of the number of files in a directory?
> directory + subdirectoies?

in a directory:
$ ls -1 $dir | wc -l

for subdirectories too:
$ find $dir -type f | wc -l

That last one gives you only the count of files. Directories themselves
are not counted.

Reply to: