shell 文件遍历

来源:互联网 发布:淘宝客链接转换php 编辑:程序博客网 时间:2024/05/17 21:07

shell 文件遍历

发现的一个脚本遍历文件的写的蛮不错的记录下。

#!/bin/bashfunction ergodic(){for file in ` ls $1`do                if [ -d $1"/"$file ] #如果 file存在且是一个目录则为真                then                      ergodic $1"/"$file                else                      local path=$1"/"$file #得到文件的完整的目录                      local name=$file       #得到文件的名字                      #做自己的工作.      echo $path"/"$name                    fidone}INIT_PATH="/home/C_workspace"ergodic $INIT_PATH 


0 0
原创粉丝点击