Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,19 @@ lss -All
## 📸 Example Output

```
Dizin: C:\Users\Muhammed
Directory: C:\Users\Muhammed
================================================================================
TIP ISIM BOYUT
TYPE NAME SIZE
================================================================================
📁 KLS .cache 4.13 GB
📁 KLS .local 5.66 GB
📁 KLS .ollama 4.36 GB
📁 KLS Apple 69.42 GB
📁 KLS anaconda3 4.47 GB
📄 DSY install.ps1 21.57 KB
📄 DSY oracle-1 3.30 KB
📁 DIR .cache 4.13 GB
📁 DIR .local 5.66 GB
📁 DIR .ollama 4.36 GB
📁 DIR Apple 69.42 GB
📁 DIR anaconda3 4.47 GB
📄 FILE install.ps1 21.57 KB
📄 FILE oracle-1 3.30 KB
================================================================================
Σ TOTAL 5 Folders, 2 Files 88.04 GB
================================================================================
```

Expand Down Expand Up @@ -179,17 +181,19 @@ lss -All
## 📸 Örnek Çıktı

```
Dizin: C:\Users\Muhammed
Directory: C:\Users\Muhammed
================================================================================
TYPE NAME SIZE
================================================================================
TIP ISIM BOYUT
📁 DIR .cache 4.13 GB
📁 DIR .local 5.66 GB
📁 DIR .ollama 4.36 GB
📁 DIR Apple 69.42 GB
📁 DIR anaconda3 4.47 GB
📄 FILE install.ps1 21.57 KB
📄 FILE oracle-1 3.30 KB
================================================================================
📁 KLS .cache 4.13 GB
📁 KLS .local 5.66 GB
📁 KLS .ollama 4.36 GB
📁 KLS Apple 69.42 GB
📁 KLS anaconda3 4.47 GB
📄 DSY install.ps1 21.57 KB
📄 DSY oracle-1 3.30 KB
Σ TOTAL 5 Folders, 2 Files 88.04 GB
================================================================================
```

Expand Down
29 changes: 21 additions & 8 deletions lss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ function Format-LssSize {
param(
[long]$Bytes
)
$culture = [System.Globalization.CultureInfo]::InvariantCulture
if ($Bytes -ge 1GB) {
return "{0:N2} GB" -f ($Bytes / 1GB)
return "{0} GB" -f ($Bytes / 1GB).ToString("N2", $culture)
}
elseif ($Bytes -ge 1MB) {
return "{0:N2} MB" -f ($Bytes / 1MB)
return "{0} MB" -f ($Bytes / 1MB).ToString("N2", $culture)
}
elseif ($Bytes -ge 1KB) {
return "{0:N2} KB" -f ($Bytes / 1KB)
return "{0} KB" -f ($Bytes / 1KB).ToString("N2", $culture)
}
else {
return "{0} Bytes" -f $Bytes
return "{0} Bytes" -f $Bytes.ToString($culture)
}
}

Expand Down Expand Up @@ -104,24 +105,36 @@ function lss {
$resolvedPath = (Resolve-Path -Path $Path -ErrorAction SilentlyContinue).Path
if (-not $resolvedPath) { $resolvedPath = $Path }

Write-Host "`nDizin: $resolvedPath" -ForegroundColor Cyan
Write-Host "`nDirectory: $resolvedPath" -ForegroundColor Cyan
Write-Host ("="*80) -ForegroundColor Cyan
Write-Host ("{0,-8} {1,-50} {2,15}" -f "TIP", "ISIM", "BOYUT") -ForegroundColor Cyan
Write-Host ("{0,-8} {1,-50} {2,15}" -f "TYPE", "NAME", "SIZE") -ForegroundColor Cyan
Write-Host ("="*80) -ForegroundColor Cyan

[int]$folderCount = 0
[int]$fileCount = 0
[long]$totalSize = 0

foreach ($entry in $sorted) {
$formattedSize = Format-LssSize -Bytes $entry.Size
$displayName = $entry.Item.Name
$totalSize += $entry.Size

if ($displayName.Length -gt 48) {
$displayName = $displayName.Substring(0, 45) + "..."
}

if ($entry.IsFolder) {
Write-Host ("{0,-8} {1,-50} {2,15}" -f "📁 KLS", $displayName, $formattedSize) -ForegroundColor Yellow
$folderCount++
Write-Host ("{0,-8} {1,-50} {2,15}" -f "📁 DIR", $displayName, $formattedSize) -ForegroundColor Yellow
}
else {
Write-Host ("{0,-8} {1,-50} {2,15}" -f "📄 DSY", $displayName, $formattedSize) -ForegroundColor Green
$fileCount++
Write-Host ("{0,-8} {1,-50} {2,15}" -f "📄 FILE", $displayName, $formattedSize) -ForegroundColor Green
}
}

$formattedTotalSize = Format-LssSize -Bytes $totalSize
Write-Host ("="*80) -ForegroundColor Cyan
Write-Host ("{0,-8} {1,-50} {2,15}" -f "Σ TOTAL", "$folderCount Folders, $fileCount Files", $formattedTotalSize) -ForegroundColor Cyan
Write-Host ("="*80 + "`n") -ForegroundColor Cyan
}