我有一个文本文件(filenames.txt),其中包含文件名及其扩展名
filename.txt
[AW] One Piece - 629 [1080P][Dub].mkv
EP.585.1080p.mp4
EP609.m4v
EP 610.m4v
One Piece 0696 A Tearful Reunion! Rebecca and Kyros!.mp4
One_Piece_0745_Sons'_Cups!.mp4
One Piece - 591 (1080P Funi Web-Dl -Ks-)-1.m4v
One Piece - 621 1080P.mkv
One_Piece_S10E577_Zs_Ambition_A_Great_and_Desperate_Escape_Plan.mp4
以下是示例文件名及其扩展名。我需要用剧集号重命名文件名(不更改其扩展名)
示例:
Input:
``````
EP609.m4v
EP 610.m4v
EP.585.1080p.mp4
One Piece - 621 1080P.mkv
[AW] One Piece - 629 [1080P][Dub].mkv
One_Piece_0745_Sons'_Cups!.mp4
One Piece 0696 A Tearful Reunion! Rebecca and Kyros!.mp4
One Piece - 591 (1080P Funi Web-Dl -Ks-)-1.m4v
One_Piece_S10E577_Zs_Ambition_A_Great_and_Desperate_Escape_Plan.mp4
Expected Output:
````````````````
609.m4v
610.m4v
585.mp4
621.mkv
629.mkv
745.mp4 (or) 0745.mp4
696.mp4 (or) 0696.mp4
591.m4v
577.mp4
希望有人能帮我解析和重命名这些文件名。提前感谢
当您标记python时,我想您愿意使用python
(编辑:我意识到在我的原始代码中不需要循环。)
这将输出
基本上,它搜索第一个3位数字,前面可能是0
我强烈建议您检查输出;特别是,您需要运行
sort OUTPUTFILENAME | uniq -d
以查看是否存在重复的目标名称(原始答复:)
程序解析插曲编号并重命名它
full/path/to/folder
-是文件所在文件夹的路径相关问题 更多 >
编程相关推荐