rename:Rename files 用字符串替换的方式批量改变文件名
参数:
源字符串 目标字符串 文件列表
实例1:
[root@www ~]# rename wget.txt wget.log wget.txt
[root@www ~]# ll wget.log
-rw-r--r-- 1 root root 80553 4月 14 03:32 wget.log
实例2:
[root@www ~]# ll *.txt
-rw-r--r-- 1 root root 94077 4月 14 03:53 passwd.txt
-rw-r--r-- 1 root root 65289 4月 14 05:43 tcpdump.txt
-rw-r--r--. 1 root root 427 11月 26 06:24 users.txt
[root@www ~]# rename .txt .log *
[root@www ~]# ll *.txt
ls: 无法访问*.txt: 没有那个文件或目录
[root@www ~]# ll *.log
-rw-r--r-- 1 root root 94077 4月 14 03:53 passwd.log
-rw-r--r-- 1 root root 65289 4月 14 05:43 tcpdump.log
-rw-r--r--. 1 root root 427 11月 26 06:24 users.log
-rw-r--r-- 1 root root 80553 4月 14 03:32 wget.log
转载于:https://blog.51cto.com/12107790/2116393
本文介绍了Linux系统中rename命令的使用方法,通过示例展示了如何利用该命令进行文件批量重命名操作,包括将文件扩展名从.txt替换为.log的过程。

3245

被折叠的 条评论
为什么被折叠?



