歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux基礎知識 >> 在Linux系統下批量改變文件名字的大小寫

在Linux系統下批量改變文件名字的大小寫

日期:2017/4/19 14:19:47   编辑:Linux基礎知識
需求:某個文件夾下所有的文件名字裡的大寫字母改成小寫字母。

解決:

for file in `ls | grep '[A-Z]'`

do

str=`echo $file|tr 'A-Z' 'a-z'`

mv $file $str

done

1)ls | grep '[A-Z]' :ls 出所有含有大寫字母的文件

2)for file in `command` :for 循環

3)echo AVdxFV | tr 'A-Z' 'a-z' : 把'AVdxFV' 中所有的大寫換成小寫字母; tr :translate的意思,具體看help.

Copyright © Linux教程網 All Rights Reserved