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
Notes
This script will only act on .psv files. It will go through the directory and rename each file based upon the PlayStation GameID specified. The new name format is <Title>_.psv. NOTE: If no Unique ID is found, the files will instead just be the name of the game title.
Warning
Make a backup of these files first. While this script does not touch the contents of each file, I cannot guarantee that there are no errors in the PlayStation game id file used.
Parameters
GameID
and a column namedTitle
to map the filenames appropriately.