From ce1538bd01aba6a73fd6b66eb2a700c17c39436c Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Thu, 19 Aug 2021 10:47:55 +0300 Subject: [PATCH] Add files via upload --- cache-spotify.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 cache-spotify.ps1 diff --git a/cache-spotify.ps1 b/cache-spotify.ps1 new file mode 100644 index 0000000..a449a4e --- /dev/null +++ b/cache-spotify.ps1 @@ -0,0 +1,13 @@ +# Launch Spotify.exe and wait for the process to stop +Start-Process -FilePath $env:APPDATA\Spotify\Spotify.exe; wait-process -name Spotify + +# This block deletes files by the last access time to it, files that have not been changed and have not been opened for more than the number of days you have selected will be deleted. (number of days = seven) +If(Test-Path -Path $env:LOCALAPPDATA\Spotify\Data){ +dir $env:LOCALAPPDATA\Spotify\Data -File -Recurse |? lastaccesstime -lt (get-date).AddDays(-7) |del +} + +# Delete the file mercury.db if its size exceeds 100 MB. +If(Test-Path -Path $env:LOCALAPPDATA\Spotify\mercury.db){ +$file_mercury = Get-Item "$env:LOCALAPPDATA\Spotify\mercury.db" +if ($file_mercury.length -gt 100MB) {dir $env:LOCALAPPDATA\Spotify\mercury.db -File -Recurse|del} +} \ No newline at end of file