Chrome Cleaner Script - moexalter/mowindows GitHub Wiki
Define the Chrome User Data path
$chromeUserDataPath = "C:\Users\admin\AppData\Local\Google\Chrome\User Data\Default"
Folders to clear
$foldersToClear = @("Cache", "Media Cache", "Code Cache", "GPUCache", "Session Storage")
Function to calculate folder size
function Get-FolderSize { param ([string]$folderPath) $folderSize = (Get-ChildItem -Path $folderPath -Recurse -File | Measure-Object -Property Length -Sum).Sum return [math]::Round($folderSize / 1GB, 2) }
Display initial size of Chrome User Data
$initialSize = Get-FolderSize -folderPath $chromeUserDataPath Write-Host "Initial size of Chrome User Data: $initialSize GB"
Clear specified folders
foreach ($folder in $foldersToClear) { $folderPath = Join-Path -Path $chromeUserDataPath -ChildPath $folder if (Test-Path -Path $folderPath) { Write-Host "Clearing $folder..." Remove-Item -Path "$folderPath*" -Recurse -Force -ErrorAction SilentlyContinue } }
Display final size of Chrome User Data
$finalSize = Get-FolderSize -folderPath $chromeUserDataPath $spaceFreed = $initialSize - $finalSize Write-Host "Final size of Chrome User Data: $finalSize GB" Write-Host "Total space freed: $spaceFreed GB"