#!/bin/bash
function getdir(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
# 此处拿到了文件的路径
if [ "${dir_or_file##*.}"x = "mp3"x ]
then
echo $dir_or_file
mv $dir_or_file ~/Downloads/export_to_phone/xuefeng/
fi
fi
done
}
root_dir="."
getdir $root_dir
shell递归遍历某路径下所有的文件
最新推荐文章于 2024-07-22 16:18:17 发布