如何批量重命名文件以匹配文本文件中的字符串列表? (Windows 11)

问题描述 投票:0回答:2

我想批量重命名大量照片以匹配我在 txt 文件中的文本行。我将新名称与照片的字母顺序对齐,并且照片的数量与文本行相同,因此我的目标是让它们从上到下正确同步。有没有一种方法可以使用 Windows 11 或免费工具来完成此操作?

这是一个例子...

Apple_12049.jpg   apple.jpg
Canon_10394.jpg  canon.jpg
Dodge_29-1.jpg   dodge.jpg

我尝试下载了很多批量重命名工具,但没有找到可以匹配文本行的。

regex rename batch-processing batch-rename
2个回答
0
投票

Perl 来拯救! (眨眼@Choroba)

$ perl -lane 'rename($F[0], $F[1])' file

如果您没有 Perl,请在您首选的搜索引擎中搜索

Strawberry Perl downloads

希望\_0< \_0< GO


0
投票

您可以为此使用 PowerShell:

cd c:\path\to\folder\with\photos
foreach($line in Get-Content c:\path\to\renaming\file.txt) {Rename-Item -path ($line -split '\s+')[0] -newname ($line -split '\s+')[1]}
© www.soinside.com 2019 - 2024. All rights reserved.