#View the number of files in the folder
ls -l | grep '^-' | wc -l

#View the number of files in a folder, including the number of files in subfolders
ls -lR | grep '^-' | wc -l

#View the number of folders under folders
ls -l | grep '^d' | wc -l

#View the number of folders under a folder, including the number of subfolders
ls -lR | grep '^d' | wc -l
Copy the code