1 頁 (共 1 頁)

How to report number of files in all subdirectories?

發表於 : 2015-05-02 21:49:55
yehlu
http://unix.stackexchange.com/questions ... irectories

代碼: 選擇全部

for f in *; do [ -d ./"$f" ] && find ./"$f" -maxdepth 1 -exec echo \; | wc -l && echo $f; done

目錄裡有多少個JPG

發表於 : 2015-05-02 21:54:38
yehlu
http://stackoverflow.com/questions/6286 ... ile-counts

代碼: 選擇全部

find -maxdepth 1 -type d | while read dir; do 
    count=$(find "$dir" -maxdepth 1 -iname \*.jpg | wc -l)
    echo "$dir ; $count"
done

代碼: 選擇全部

find -maxdepth 1 -type d | while read dir; do 
    count=$(find "$dir" -maxdepth 1 -iname \* | wc -l)
    echo "$dir ; $count"
done