shell脚本遍历文件夹下所有文件

脚本内容:

#!/bin/bash
#by fuqiang
#2019-04-23

function getdir(){
    for element in `ls $1`
      do
        dir_or_file=$1"/"$element
    if [ -d $dir_or_file ]
      then
        getdir $dir_or_file
      else
        echo $dir_or_file     
    fi
done
}

root_dir="/home/"
getdir $root_dir

猜你喜欢

转载自blog.csdn.net/kevinsingapore/article/details/89483342
今日推荐