批量查看目录下文件数目

情景1:

有目录AAA, 有子目录 A1 - A100。 批量查看各个子目录下文件或者目录数目:

运行在AAA下。bash count.sh

#!/bin/bash
# useage
# ./thisfilename.sh source
# NOTE:
#
#  ensure this .sh file is changed mod
#  source is which dir you want to operate
#  

function getfiles(){
  for file in `ls $1`
  do
    echo "------------------------"$file
    ls $file | wc -l
  done
}

getfiles $1

 

你可能感兴趣的:(linux,批量,数目,shell脚本)