![Linux Shell Scripting Cookbook(Third Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/161/36701161/b_36701161.jpg)
上QQ阅读APP看书,第一时间看更新
Generating a summary of files and sub-directories
We can generate a list of subdirectories, and the number of files in them, with a combination of the find command, echo, and wc commands, which will be discussed in greater detail in the next chapter.
Use the following to get a summary of files in the current folder:
for d in `find . -type d`; do echo `find $d -type f | wc -l` files in $d; done
If this script is run in /var/log, it will generate output like this:
103 files in . 17 files in ./cups 0 files in ./hp 0 files in ./hp/tmp