Skip to content

Instantly share code, notes, and snippets.

@joeybaumgartner
Created September 1, 2023 12:54
Show Gist options
  • Save joeybaumgartner/981757bcee070d0296768acc66ff24f6 to your computer and use it in GitHub Desktop.
Save joeybaumgartner/981757bcee070d0296768acc66ff24f6 to your computer and use it in GitHub Desktop.
Utility to rename PS game saves
[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
}
}
@joeybaumgartner
Copy link
Author

I did find a PS2 game ID list here, and used it for testing this script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment