文件批量重命名(大小写转换)

#!/bin/bash

#Auth: Zz

#Script: folder rename

for fileName in `ls test_dir`                                                                         #会先执行``中的命令

 do 

  lowercase=`echo $fileName | tr '[A-Z]'  '[a-z]'`                                         #tr进行大小写转换

   echo $lowercase                                                                                    #先输出一下看是否转换正确

   ### mv test_dir/$fileName test_dir/$lowercase                                     #输出正确后将注释符号拿掉再运行。

 done

echo success

你可能感兴趣的:(shell,linux)