如何进行批量重命名? [英] How to do a mass rename?
本文介绍了如何进行批量重命名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要像这样重命名文件名
I need to rename files names like this
transform.php?dappName=Test&transformer=YAML&v_id=XXXXX
就这样
XXXXX.txt
我该怎么做?
我知道我需要多个 mv
命令,因为它们至少有 25000 个文件.
I understand that i need more than one mv
command because they are at least 25000 files.
推荐答案
最简单的解决方案是使用 "mmv"
Easiest solution is to use "mmv"
你可以写:
mmv "long_name*.txt" "short_#1.txt"
其中#1"被第一个通配符匹配的任何内容替换.同样#2被第二个替换,以此类推
Where the "#1" is replaced by whatever is matched by the first wildcard. Similarly #2 is replaced by the second, etc.
所以你做类似的事情
mmv "index*_type*.txt" "t#2_i#1.txt"
将 index1_type9.txt 重命名为 t9_i1.txt
To rename index1_type9.txt to t9_i1.txt
mmv 在许多 Linux 发行版中不是标准的,但在网上很容易找到.
mmv is not standard in many Linux distributions but is easily found on the net.
这篇关于如何进行批量重命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文