我需要批量重命名这些文件:
file001 ().mp4 file002 ().mp4 file003 ().mp4
改名为:
文件001.mp4 文件002.mp4stackNewline file003.mp4
我尝试过这个命令,rename "s/ ()//g" *,但是它没有工作。
发布于 2016-12-16 14:42:01
rename接受正则表达式作为模式:
DESCRIPTION
"rename" renames the filenames supplied according to the rule specified
as the first argument. The perlexpr argument is a Perl expression在您的示例中,用于匹配的正则表达式是(),但括号是此类表达式中的特殊字符,需要像\(\)那样转义。
发布于 2016-12-16 14:56:25
您可以使用pyrenamer (至少不用担心regex)
sudo apt-get install pyrenamer(方括号中的数字指答案底部的图像)
Substitutions选项卡2Replace,然后在第一个文本框中设置(),留下第二个空的3.
https://askubuntu.com/questions/861317
复制相似问题