shell批量修改文件名

[root@localhost file1]# ls
a.htm  b.htm  c.htm  d.htm  pl.sh
[root@localhost file1]# vi pl.sh 
#!/bin/bash
for f in `ls *.htm`
do
        mv $f `echo ${f/htm/html}`
done
[root@localhost file1]# sh pl.sh 
[root@localhost file1]# ls
a.html  b.html  c.html  d.html  pl.sh
[root@localhost file1]# 

当前可以使用rename命令进行修改

rename命令详解

posted @ 2018-07-18 23:47  数据库BOSS  阅读(226)  评论(0编辑  收藏  举报