更新时间:2022-12-24 09:30:15
使用重命名
,您可以像这样进行重命名:
Using rename
you can do the renaming like this:
rename -n 's/([^_]+)_([^.]+).pdf/$2_$1.pdf/g' *.pdf
选项 -n
不执行任何操作,仅显示将发生的情况.如果满意,请删除 -n
选项.
The option -n
does nothing, it just prints what would happen. If you are satisfied, remove the -n
option.
我使用 [^ _] +
和 [^.] +
捕获 _
之前和之后的文件名部分..语法 [^ _]
表示除 _
之外的所有内容.
I use [^_]+
and [^.]+
to capture the part of the filename before and after the the _
. The syntax [^_]
means everything but a _
.