$OutputEncoding = [System.Text.Encoding]::UTF8

Write-Host "=== Top folders in user profile ==="
Get-ChildItem -Path $env:USERPROFILE -Directory -Force -ErrorAction SilentlyContinue | ForEach-Object {
    $size = (Get-ChildItem -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
    [PSCustomObject]@{
        Folder = $_.Name
        SizeMB = [math]::Round($size/1MB,2)
    }
} | Sort-Object SizeMB -Descending | Select-Object -First 15 | Format-Table -AutoSize

Write-Host ""
Write-Host "=== Top folders in AppData\Local ==="
Get-ChildItem -Path "$env:LOCALAPPDATA" -Directory -Force -ErrorAction SilentlyContinue | ForEach-Object {
    $size = (Get-ChildItem -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
    [PSCustomObject]@{
        Folder = $_.Name
        SizeMB = [math]::Round($size/1MB,2)
    }
} | Sort-Object SizeMB -Descending | Select-Object -First 15 | Format-Table -AutoSize

Write-Host ""
Write-Host "=== Large files in Downloads (>50MB) ==="
Get-ChildItem -Path "$env:USERPROFILE\Downloads" -Recurse -Force -ErrorAction SilentlyContinue | Where-Object { -not $_.PSIsContainer -and $_.Length -gt 50MB } | Sort-Object Length -Descending | Select-Object -First 20 | ForEach-Object {
    [PSCustomObject]@{
        Name = $_.Name
        SizeMB = [math]::Round($_.Length/1MB,2)
        LastWrite = $_.LastWriteTime.ToString("yyyy-MM-dd")
    }
} | Format-Table -AutoSize
