1. CentOS和ubuntu的rename的命令是不一样的.
CentOS的rename 使用的是c语言版本的 而ubuntu的rename使用的是 perl的版本,意味着很多ubuntu上面的扩展命令 CentOS不支持.
2. 解决办法, 在CentOS上面安装prename包
prename 是 CentOS上面的perl语言版本的rename软件 安装方法 首先安装 epel 扩展包 yum install epel-release -y 安装完成之后 安装 prename包 yum install prename -y
3.执行最简单的命令测试
其实使用的命令就是
prename 'y/a-z/A-Z/' *
简单进行测试 文件和文件夹都可以进行修改.
[root@CentOS77 zhaobshrename]# ll total 0 drwxr-xr-x. 2 root root 6 Nov 20 08:59 a.a -rw-r--r--. 1 root root 0 Nov 20 08:59 b.b [root@CentOS77 zhaobshrename]# prename 'y/a-z/A-Z/' * [root@CentOS77 zhaobshrename]# ll total 0 drwxr-xr-x. 2 root root 6 Nov 20 08:59 A.A -rw-r--r--. 1 root root 0 Nov 20 08:59 B.B [root@CentOS77 zhaobshrename]#
4. 简单的help文件
Usage: prename [OPTION]... PERLEXPR FILE... Rename FILE(s) using PERLEXPR on each filename. -b, --backup make backup before removal -B, --prefix=SUFFIX set backup filename prefix -f, --force remove existing destinations, never prompt -i, --interactive prompt before overwrite -l, --link-only link file instead of reame -n, --just-print, --dry-run don't rename, implies --verbose -v, --verbose explain what is being done -V, --version-control=METHOD override the usual version control -Y, --basename-prefix=PREFIX set backup filename basename prefix -z, -S, --suffix=SUFFIX set backup filename suffix --help display this help and exit --version output version information and exit The backup suffix is ~, unless set with SIMPLE_BACKUP_SUFFIX. The version control may be set with VERSION_CONTROL, values are: numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups Report bugs to pederst@cpan.org