Linux文件单个重命名通常用mv命令,集体重命名不少人本身写一个简单脚本,可是其实Linux的rename命令能够简单实现绝大多数的重命名html
任务。man rename结果以下:ide
NAMEspa
rename - Rename files.net
SYNOPSISorm
rename from to file...htm
DESCRIPTIONblog
rename will rename the specified files by replacing the first occurrence of from in their name by to.ci
For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commandsget
rename foo foo0 foo?it
rename foo foo0 foo??
will turn them into foo001, ..., foo009, foo010, ..., foo278.
And
rename .htm .html *.htm
will fix the extension of your html files.
好比我有三个文件:
hs_ok_all_200911.txt
hs_ok_all_a.txt
hs_ok_all_b.txt
我须要将全部的hs_ok_all改成hs
则使用
rename hs_ok_all hs hs_ok_all_*
便可。
因此rename的第一个参数是要改的部分, 第二个参数是改后的结果,第三个参数是须要改的文件(含通配符)
转自http://blog.csdn.net/skydreamer01/archive/2010/02/08/5298646.aspx