目录名大小写转换
使用find把目录名修改为大写——-
find . -type d | sort -r |\
while read name
do
echo "mv $name ${name%/*}/echo ${name##*/} | tr '[:lower:]' '[:upper:]'
"
mv $name ${name%/*}/echo ${name##*/} | tr '[:lower:]' '[:upper:]'
done
使用递归方式把目录名修改为小写
#!/bin/bash
# set -x
tolower () {
ls | while read name
do
if [ -d $name ] ; then
new_name=echo $name | tr "[:upper:]" "[:lower:]"
if [[ $name != $new_name ]] ; then
mv $name $new_name
fi
cd $new_name
tolower
fi
done
}
tolower