View the count of files in the current directory, including subdirectories.
ls-lr| grep "^-" | wc-l[Drink Small wine net pick]http://blog.hehehehehe.cn/a/12311.htm
Under Linux see a directory of files, or folders in the number of 3 commands: LS column directory, with grep, and then use the WC statistics.
To illustrate:
1. View the number of files in the current directory
Ls-l | grep "^-" | Wc-l
2, check the statistics of the current directory of the number of files, including sub-directories.
ls-lr| grep "^-" | Wc-l
3. See the number of folders (directories) in a directory, including subdirectories.
ls-lr| grep "^d" | Wc-l
Command explanation:
Ls-l
Long list output file information in this directory (note that the file here, different from the general file, may be a directory, links, device files, etc.), each line corresponding to a file or directory, if you want to list all subdirectories of the file is LS-LR.
grep "^-"
Here, the long list output information is filtered in part, only the general file, if only the directory is grep "^d".
Wc-l
Statistics output information of the number of rows, because it has been filtered to only the general file, so the statistical results are general file information line number, and because one line of information corresponding to a file, so that is the number of files.
Linux LS lists the number of files in the directory