# Description: This script fixes Spotify playlist caching issues. # Define paths for both MS Store and regular installations $msStorePath = Join-Path $env:LOCALAPPDATA "Packages\SpotifyAB.SpotifyMusic_zpdnekdrzrea0\LocalState\Spotify\Users" $regularPath = Join-Path $env:APPDATA "Spotify\Users" $foundUsers = $false # Check MS Store installation if (Test-Path $msStorePath) { Write-Host "Found Microsoft Store Spotify installation" $userDirs = Get-ChildItem -Path $msStorePath -Directory -Filter "*-user" foreach ($userDir in $userDirs) { $foundUsers = $true $ldbPath = Join-Path $userDir.FullName "primary.ldb" if (Test-Path $ldbPath -PathType Container) { try { Remove-Item -Path $ldbPath -Recurse -Force Write-Host "✓ Cleared cache for user in: $($userDir.Name)" } catch { Write-Warning "Failed to clear cache in $($userDir.Name): $_" } } } } # Check regular installation if (Test-Path $regularPath) { Write-Host "Found regular Spotify installation" $userDirs = Get-ChildItem -Path $regularPath -Directory -Filter "*-user" foreach ($userDir in $userDirs) { $foundUsers = $true $ldbPath = Join-Path $userDir.FullName "primary.ldb" if (Test-Path $ldbPath -PathType Container) { try { Remove-Item -Path $ldbPath -Recurse -Force Write-Host "✓ Cleared cache for user in: $($userDir.Name)" } catch { Write-Warning "Failed to clear cache in $($userDir.Name): $_" } } } } if (-not $foundUsers) { Write-Warning "No Spotify users found in either location:`n- $msStorePath`n- $regularPath" } else { Write-Host "`nDone! Restart Spotify to rebuild the cache." }