【实证】
第一步:文件名及扩展名转换为大写
参考:http://blog.chinaunix.net/uid-24426415-id-77492.html
#!/bin/bash dir="./"; files=`find $dir -type f`; for i in $files do dir_name=`dirname $i`; ori_filename=`basename $i`; new_filename=`echo $ori_filename | tr [:lower:] [:upper:]`>/dev/null; mv -f $dir_name/$ori_filename $dir_name/$new_filename done
第二步:把扩展名转换为小写
参考:https://blog.csdn.net/longxibendi/article/details/6387732
find ./ -name "*.PHP" | awk -F "." '{print $2}' | xargs -i -t mv ./{}.PHP ./{}.php
【参考】
参考:https://blog.chaos.run/dreams/linux-rename-all-files-in-a-directory-to-uppercase/index.html
参考:https://blog.csdn.net/tuzhg/article/details/81455924
参考:https://blog.csdn.net/qq_36792209/article/details/82695477
for f in *; do mv "$f" "${f^^}"; done
for f in *; do mv "$f" "$(echo "$f" | tr '[:lower:]' '[:upper:]')"; done
#!/bin/bash for fileName in `ls test` do lowercase=`echo $fileName | tr '[A-Z]' '[a-z]'` echo $lowercase mv test/$fileName test/$lowercase done echo success