不同于Dos下的rename命令,linux下的rename命令功能非常强大。
#man rename
NAME
rename - Rename files
SYNOPSIS
rename from to file...
DESCRIPTION
rename will rename the specified files by replacing the first occurrence of from in their name by to.
For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commands
rename foo foo0 foo?
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.
从上面可以看到:
1. rename命令是三个参数
2. rename命令支持通配符进行批量重命名
3. rename命令会不会支持正则表达式
rename的参数
rename命令的格式:
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]
第一个参数:被替换掉的字符串
第二个参数:替换成的字符串
第三个参数:匹配要替换的文件模式