mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-27 10:23:17 +01:00
Improve list-formatted.ps1
This commit is contained in:
parent
f83042c654
commit
8e1a552dc2
@ -11,12 +11,14 @@ param($Directory = "$PWD")
|
||||
function ListDir { param([string]$Path)
|
||||
$Items = get-childItem -path $Path
|
||||
foreach ($Item in $Items) {
|
||||
if ($Item.Name[0] -eq '.') { continue } # hidden file/dir
|
||||
if ($Item.Mode -like "d*") {
|
||||
new-object PSObject -Property @{ Name = "📂$($Item.Name)" }
|
||||
} else {
|
||||
new-object PSObject -Property @{ Name = "📄$($Item.Name)" }
|
||||
}
|
||||
$Name = $Item.Name
|
||||
if ($Name[0] -eq '.') { continue } # hidden file/dir
|
||||
if ($Item.Mode -like "d*") { $Icon = "📂"
|
||||
} elseif ($Name -like "*.iso") { $Icon = "📀"
|
||||
} elseif ($Name -like "*.mp3") { $Icon = "🎵"
|
||||
} elseif ($Name -like "*.epub") { $Icon = "📓"
|
||||
} else { $Icon = "📄" }
|
||||
new-object PSObject -Property @{ Name = "$Icon$Name" }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user