function get_dir(){
IFS=$'\n'
for element in `ls $1`
do
new_element=`echo "$element"|sed 's/ /_/g'`
#echo "$1/$element, $1/$new_element" #|sed -n 'l'
if [ "$element" != "$new_element" ];then
echo -e "\033[33m $1/$element ==> $1/$new_element\033[0m"
mv "$1/$element" "$1/$new_element"
fi
dir_or_file="$1/$new_element"
#echo $dir_or_file
if [ -d "$dir_or_file" ];then
get_dir "$dir_or_file"
else
process_file "$dir_or_file"
fi
done
}
网友评论