问题:查找当前目录及其子目录下所有扩展名为.txt的文件,将其扩展名修改为.html


方法1:

rename .txt  .html   *.txt


方法2:

find . -type f -name "*.txt" -print0 | xargs -0 rename .txt .html {}

使用find的-print0和 xargs的-0选项,可以解决文件名中包含空格的问题。


方法3:

for file in *.html; do mv $file ${file%.html}.txt; done


方法4、5、6、7......


欢迎补充 哈哈哈

欢迎回帖交流