Linux中查看指定文件夹内各个子文件夹内的文件数量
count脚本#!/bin/sh numOfArgs=$# if [ $numOfArgs -ne 1 ]; then echo -e "Usage: \nbash执行
dirForCount" exit -1 fi # args ROOTDIR= # core part find $ROOTDIR -maxdepth 1 -type d | sort | while read dir; do count=$(find "$dir" -type f | wc -l) echo "$dir: $count" done
总结benchmark/4: 1328benchmark/3: 13
$ bash count.sh benchmark
benchmark: 2317
benchmark/0: 20
benchmark/1: 891
benchmark/2: 65
评论列表(0条)