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

Re: number of files in directory?

Thomas Adam wrote:
--- Lance Hoffmeyer <lance@augustmail.com> wrote:
How can I get a count of the number of files in a directory?
directory + subdirectoies?


ls -1 | wc -l

(note the "-1" option to 'ls' is hyphen-one, NOT lower-case L, which is
what the option to 'wc' is).

Note, too, that the "-1" option is not deeded, as ls detects that stdout
isn't a terminal, and it wil use one-collumn output with or without the "-1".


Reply to: