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 @@ -25,6 +25,7 @@
- ✅ Automatic unit conversion (Bytes, KB, MB, GB)
- ✅ **Sorting by size**: Folders first (largest to smallest), then files (largest to smallest)
- ✅ Colored output (folders in yellow, files in green) with emojis (📁 / 📄)
- ✅ **Total summary**: Displays directory count, file count, and overall total size at the bottom
- ✅ Can be used like `ls` in any folder
- ✅ High-performance stack-based directory traversal to process large trees efficiently

Expand Down Expand Up @@ -75,18 +76,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 Directories, 2 Files | Total Size: 88.04 GB
```

## 🛠️ Requirements
Expand Down Expand Up @@ -129,6 +131,7 @@ Don't forget to give a star if you find the project useful!
- ✅ Otomatik birim dönüşümü (Bytes, KB, MB, GB)
- ✅ **Boyuta göre sıralama**: Önce klasörler (büyükten küçüğe), sonra dosyalar (büyükten küçüğe)
- ✅ Emojili (📁 / 📄) ve renkli çıktı (klasörler sarı, dosyalar yeşil)
- ✅ **Özet bilgi**: En altta toplam klasör sayısını, dosya sayısını ve genel toplam boyutu gösterir
- ✅ Her klasörde `ls` gibi kullanılabilir
- ✅ Büyük dizin ağaçlarını hızlıca işlemek için yüksek performanslı stack tabanlı dizin tarama yapısı

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

```
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 Directories, 2 Files | Total Size: 88.04 GB
```

## 🛠️ Gereksinimler
Expand Down
2 changes: 1 addition & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if ($profileContent -match "function lss") {

if ($response -eq "E") {
# Eski lss fonksiyonunu kaldır
$profileContent = $profileContent -replace "(?ms)# PowerShell Profiline.*?^}", ""
$profileContent = $profileContent -replace "(?ms)# PowerShell Profiline.*?^function lss\b.*?^}", ""
$profileContent = $profileContent.Trim()

# Yeni fonksiyonu ekle
Expand Down
32 changes: 21 additions & 11 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 [string]::Format($culture, "{0:N2} GB", $Bytes / 1GB)
}
elseif ($Bytes -ge 1MB) {
return "{0:N2} MB" -f ($Bytes / 1MB)
return [string]::Format($culture, "{0:N2} MB", $Bytes / 1MB)
}
elseif ($Bytes -ge 1KB) {
return "{0:N2} KB" -f ($Bytes / 1KB)
return [string]::Format($culture, "{0:N2} KB", $Bytes / 1KB)
}
else {
return "{0} Bytes" -f $Bytes
return [string]::Format($culture, "{0} Bytes", $Bytes)
}
}

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

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

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

foreach ($entry in $sorted) {
$totalSize += $entry.Size
$formattedSize = Format-LssSize -Bytes $entry.Size
$displayName = $entry.Item.Name
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
$dirCount++
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
}
}
Write-Host ("="*80 + "`n") -ForegroundColor Cyan
Write-Host ("="*80) -ForegroundColor DarkGray
$formattedTotalSize = Format-LssSize -Bytes $totalSize
Write-Host ("Total: $dirCount Directories, $fileCount Files | Total Size: $formattedTotalSize`n") -ForegroundColor Cyan
}