Skip to content

Instantly share code, notes, and snippets.

@DoganM95
Last active March 23, 2021 18:01
Show Gist options
  • Save DoganM95/6aa5fca7bd414a652cdd0ae039dc89c6 to your computer and use it in GitHub Desktop.
Save DoganM95/6aa5fca7bd414a652cdd0ae039dc89c6 to your computer and use it in GitHub Desktop.
Updates the path of all games in playnite library to a new one. Executable names are kept untouched
# Configure the following 3 paths before using
$pathToReplace = "N:\\Library\\Games\\Sony\\PSP"
$replacementPath = "N:\\Games\\Sony\\PSP"
$pathOfGameSettings = "C:\Users\Dogan\OneDrive\Portable Apps\Playnite\library\games"
# Script
$pathToReplace = $pathToReplace.Replace("\\", "\\\\")
$processedFileCount = 0;
Get-ChildItem $pathOfGameSettings -Filter *.json |
Foreach-Object {
if ((Get-Content $_.FullName) -match $pathToReplace) {
$processedFileCount++
Write-Output $_.Name
((Get-Content $_.FullName) -replace $pathToReplace, $replacementPath) | Set-Content $_.FullName
}
}
Write-Host "Processed $processedFileCount files." -ForegroundColor green
Write-Host "Press any key to exit..."
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment