IMPLEMENTED - Multi rename - Rename from text file contents
Posted: 11.09.2021, 00:51
It would be useful to have the ability to rename from the contents of a text file. So that if I select 50 files and have a text file with 50 names then the multi rename dialog could use that file to rename the files based on that.
As you can see from the example, I've selected the files with the .max extension. I was after a way to rename the .jpg file the exact same name so I thought that this suggestion could be useful for cases like this.
If the file contents doesn't match the file count then there could be a warning message to inform the user that there's a different number of lines in the text file.
I can do it with this PowerShell code but having something like this built into the MR would be great.
As you can see from the example, I've selected the files with the .max extension. I was after a way to rename the .jpg file the exact same name so I thought that this suggestion could be useful for cases like this.
If the file contents doesn't match the file count then there could be a warning message to inform the user that there's a different number of lines in the text file.
I can do it with this PowerShell code but having something like this built into the MR would be great.
Code: Select all
#Mod of this code: https://stackoverflow.com/a/20061560/8262102
$names = Get-Content -LiteralPath "C:\Users\username\Desktop\rename-list.txt"
$files = "Z:\Folder path of files\"
$filesExt = "jpg"
# What if
Get-ChildItem "$files\*.$filesExt" | Foreach {$i=0} {Rename-Item $_ ($names[$i++] + $_.extension) -WhatIf}
# Do the rename - NOTE: Unblock this once your happy with the above.
# Get-ChildItem "$files\*.$filesExt" | Foreach {$i=0} {Rename-Item $_ ($names[$i++] + $_.extension)}