Created
September 1, 2023 12:54
-
-
Save joeybaumgartner/981757bcee070d0296768acc66ff24f6 to your computer and use it in GitHub Desktop.
Utility to rename PS game saves
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string] | |
$Path, | |
[Parameter()] | |
[string] | |
$PsxList | |
) | |
$Header = (Get-Content -Path $PsxList -TotalCount 1).Split(';') | |
$Csv = Import-Csv $PsxList -Delimiter ';' -Header $Header | |
$FileList = Get-ChildItem -Path $Path -Filter "*.psv" | |
$GameIdLength = 8 | |
ForEach ($FileName in $FileList) { | |
$GameId = $FileName.Name.Substring(2, 2 + $GameIdLength) | |
$UniqueId = $FileName.Name.Substring(2 + 2 + $GameIdLength) | |
$Title = $csv | Where-Object { $_.GameID -eq $GameId} | |
if($Title.Length -gt 0) { | |
if($UniqueId.Length -gt 0) { | |
$NewName = "$($Title.Name)_$UniqueId" | |
} | |
else { | |
$NewName = $Title.Name | |
} | |
Write-Host "Renaming $($FileName.Name) to $NewName" | |
Rename-Item -Path $FileName -NewName $NewName | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did find a PS2 game ID list here, and used it for testing this script.