批量建立文件
bash
[root@localhost test]# touch test{01..10} [root@localhost test]# ls test01 test02 test03 test04 test05 test06 test07 test08 test09 test10
2.rename批量修改文件ide
[root@localhost test]# ls hello02 hello03 hello04 hello05 hello06 hello07 hello08 hello09 [root@localhost test]# rename hello test hello* [root@localhost test]# ls test02 test03 test04 test05 test06 test07 test08 test09
[root@localhost test]# ls test04.log test05.log test06.log test07.log test08.log test09.log test10.log [root@localhost test]# rename .log .txt *.log [root@localhost test]# ls test04.txt test05.txt test06.txt test07.txt test08.txt test09.txt test10.txt
[root@localhost test]# ls test04.txt test05.txt test06.txt test07.txt test08.txt test09.txt test10.txt [root@localhost test]# rename .txt "" *.txt [root@localhost test]# ls test04 test05 test06 test07 test08 test09 test10
3.for循環修改文件名ci
[root@localhost test]# ls test02 test03 test04 test05 test06 test07 test08 test09 [root@localhost test]# for i in *; do mv $i $i".log" ; done [root@localhost test]# ls test02.log test03.log test04.log test05.log test06.log test07.log test08.log test09.log