$ ls -lR ./collection | grep "^-" | wc -l
$ ls -lR ./collection | grep "^d" | wc -l
$ ls -l ./collection | grep "^-" | wc -l
RRecursive subdirectory.^-Indicates a file.^dIndicates a directory.wc -lCount the number of lines of output information.