linux命令之rename

本文详细介绍了 Linux 下的 rename 命令,该命令用于批量重命名文件,并支持通配符匹配。通过示例展示了如何使用 rename 命令进行文件名的批量更改。
不同于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 ]

 

第一个参数:被替换掉的字符串
第二个参数:替换成的字符串
第三个参数:匹配要替换的文件模式
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值