travel_file(){ cd $1 for file in `ls` do if [ -d $file ] then echo "" >> $filepath/ret.txt echo -e $file Directory "\c" >> $filepath/ret.txt fi if [ -f $file ] then echo -e File $file "\c" >> $filepath/ret.txt fi if [ -d $file ] then travel_file $file fi done}if [ $# -lt 1 ]then echo "输入文件目录" exit -1fi if [ ! -d $1 ]then echo "$1 不是目录" exit -1fifilepath=`pwd`if [ -f $filepath/ret.txt ]then rm $filepath/ret.txtfitravel_file $1文件名称 file.sh 执行命令 file.sh test 生成文件格式folder1 Directory File a.txt File b.txt File c.txt subfolder Directory File d.txt File e.txt
取消
评论