mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-30 11:54:32 +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)
|
function ListDir { param([string]$Path)
|
||||||
$Items = get-childItem -path $Path
|
$Items = get-childItem -path $Path
|
||||||
foreach ($Item in $Items) {
|
foreach ($Item in $Items) {
|
||||||
if ($Item.Name[0] -eq '.') { continue } # hidden file/dir
|
$Name = $Item.Name
|
||||||
if ($Item.Mode -like "d*") {
|
if ($Name[0] -eq '.') { continue } # hidden file/dir
|
||||||
new-object PSObject -Property @{ Name = "📂$($Item.Name)" }
|
if ($Item.Mode -like "d*") { $Icon = "📂"
|
||||||
} else {
|
} elseif ($Name -like "*.iso") { $Icon = "📀"
|
||||||
new-object PSObject -Property @{ Name = "📄$($Item.Name)" }
|
} 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