乔木老师

乔木老师的博客

他的个人主页  他的博客

linux下rename 的典型应用

乔木老师  2010年06月15日 星期二 14:03 | 1345次浏览 | 0条评论

rename 的典型应用:

0. 批量更改文件扩展名
$ ls
1.txt 2.txt 3.txt 4.txt
$ rename 's/\.txt/\.ext/' *
$ ls
1.ext 2.ext 3.ext 4.ext
1. 批量删除文件扩展名
$ ls
1.txt 2.txt 3.txt 4.txt
$ rename 's/\.txt//' *
$ ls
1 2 3 4
2. 批量添加文件扩展名
   $ ls
1 2 3 4
$ rename 's/$/\.txt/' *
$ ls
1.txt 2.txt 3.txt 4.txt
3. 按自己的方式批量重命名文件
$ ls
1.ext 2.ext 3.ext 4.ext
$ rename 's/(\d)/第$1 章/' *
$ ls
第 1 章.ext 第 2 章.ext 第 3 章.ext 第 4 章.ext

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号