function check_dir() {
res=0
if [ -f $1 ]; then
res=1
fi
echo $res
return $?
}
function get_file_path() {
res=0
for file in $1/*
do
if [ -f $file ]
then
res=1
else
res_val=$(get_file_path $file)
echo "$file res val: $res_val"
if [ $res_val -eq 1 ]
then
echo $file >> files_list.txt
buffer_name=${file##*/}
fi
fi
done
echo $res
return $?
}
echo "Dir:$1"
if [ -d "${1}" ]; then
cd $1
current_path=$(pwd)
echo "current_path: $current_path"
cd $current_path
if [ -f files_list.txt ]
then
rm files_list.txt
fi
get_file_path $current_path
else
echo "Dir:$1 error"
fi
获取文件夹下所有文件list
最新推荐文章于 2023-04-12 15:09:10 发布