diff --git a/Cache/cache-spotify.ps1 b/Cache/cache-spotify.ps1 index 4ec4919..1866214 100644 --- a/Cache/cache-spotify.ps1 +++ b/Cache/cache-spotify.ps1 @@ -15,7 +15,7 @@ $day = 7 # Number of days after which the cache is considered stale try { If (!(Test-Path -Path $env:LOCALAPPDATA\Spotify\Data)) { - "$(Get-Date -uformat ‘%D %T’) Folder Local\Spotify\Data not found" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Folder Local\Spotify\Data not found" | Out-File log.txt -append exit } $check = Get-ChildItem $env:LOCALAPPDATA\Spotify\Data -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day) @@ -25,19 +25,19 @@ try { $sum = $count | Measure-Object -Property Length -sum if ($sum.Sum -ge 104434441824) { $gb = "{0:N2} Gb" -f (($check | Measure-Object Length -s).sum / 1Gb) - "$(Get-Date -uformat ‘%D %T’) Removed $gb obsolete cache" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Removed $gb obsolete cache" | Out-File log.txt -append } else { $mb = "{0:N2} Mb" -f (($check | Measure-Object Length -s).sum / 1Mb) - "$(Get-Date -uformat ‘%D %T’) Removed $mb obsolete cache" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Removed $mb obsolete cache" | Out-File log.txt -append } Get-ChildItem $env:LOCALAPPDATA\Spotify\Data -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day) | Remove-Item } if ($check.Length -lt 1) { - "$(Get-Date -uformat ‘%D %T’) Stale cache not found" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Stale cache not found" | Out-File log.txt -append } } catch { - "$(Get-Date -uformat ‘%D %T’) $error[0].Exception" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") $error[0].Exception" | Out-File log.txt -append } exit \ No newline at end of file diff --git a/Cache/cache_spotify_ru.ps1 b/Cache/cache_spotify_ru.ps1 index 23a4ed2..3f020e1 100644 --- a/Cache/cache_spotify_ru.ps1 +++ b/Cache/cache_spotify_ru.ps1 @@ -15,7 +15,7 @@ $day = 7 # Количество дней после которых кеш счи try { If (!(Test-Path -Path $env:LOCALAPPDATA\Spotify\Data)) { - "$(Get-Date -uformat ‘%D %T’) Папка Local\Spotify\Data не найдена" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Папка Local\Spotify\Data не найдена" | Out-File log.txt -append exit } $check = Get-ChildItem $env:LOCALAPPDATA\Spotify\Data -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day) @@ -25,19 +25,19 @@ try { $sum = $count | Measure-Object -Property Length -sum if ($sum.Sum -ge 104434441824) { $gb = "{0:N2} Gb" -f (($check | Measure-Object Length -s).sum / 1Gb) - "$(Get-Date -uformat ‘%D %T’) Удалено $gb устаревшего кеша" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Удалено $gb устаревшего кеша" | Out-File log.txt -append } else { $mb = "{0:N2} Mb" -f (($check | Measure-Object Length -s).sum / 1Mb) - "$(Get-Date -uformat ‘%D %T’) Удалено $mb устаревшего кеша" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Удалено $mb устаревшего кеша" | Out-File log.txt -append } Get-ChildItem $env:LOCALAPPDATA\Spotify\Data -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day) | Remove-Item } if ($check.Length -lt 1) { - "$(Get-Date -uformat ‘%D %T’) Устаревшего кеша не найдено" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Устаревшего кеша не найдено" | Out-File log.txt -append } } catch { - "$(Get-Date -uformat ‘%D %T’) $error[0].Exception" | Out-File log.txt -append + "$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") $error[0].Exception" | Out-File log.txt -append } exit \ No newline at end of file