Last active
March 23, 2021 18:01
-
-
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
This file contains 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
# 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