# View the number of files in the current directory (does not include files in subdirectories)
ls -l|grep "^-"| wc -l
# View the current number of files in the directory (including files in subdirectories) Note: R, represents the subdirectory
ls -lR|grep "^-"| wc -l
# Check current file folder under the directory number of a directory (subdirectory of the directory is not included), with the above-described processing, if necessary to view the subdirectories, with R
ls -l|grep "^d"| wc -l
# Query all the files in the directory specified number prefix the name of the current path
# eg: all statistics to all files in the "20161124" at the beginning of the catalog number
ls -lR 20161124*/|grep "^-"| wc -l
Parameters for each command to do something Remarks:
LS the -l
This command refers to a long list of output information in the specified directory (not specified then the current directory), R represents the subdirectory "file", the "file" means is a general term for directories, links, equipment, documents, etc.
grep "^ d" indicates a directory, "^ -" indicates that the file
wc -l
represents the number of lines of output statistics, because after the previous filtration has only an ordinary file, a directory or a file corresponding to one line, the line number information, statistics is the number of directories or files
turn: