Update list-dir-tree.ps1 and list-folder.ps1

This commit is contained in:
Markus Fleschutz 2023-04-26 16:53:53 +02:00
parent 6abf457fb3
commit f3ba42d867
2 changed files with 21 additions and 19 deletions

View File

@ -17,14 +17,16 @@ param([string]$DirTree = "$PWD")
function GetFileIcon { param([string]$Suffix) function GetFileIcon { param([string]$Suffix)
switch ($Suffix) { switch ($Suffix) {
".csv" { return "📊" } ".conf" {return "⚙️"}
".epub" { return "📓" } ".csv" {return "📊"}
".gif" { return "🎨" } ".epub" {return "📓"}
".iso" { return "📀" } ".gif" {return "📸"}
".jpg" { return "🎨" } ".iso" {return "📀"}
".mp3" { return "🎵" } ".jpg" {return "📸"}
".mkv" { return "🎬" } ".mp3" {return "🎵"}
default { return "📄" } ".mkv" {return "🎬"}
".zip" {return "📦"}
default {return "📄"}
} }
} }
@ -53,7 +55,7 @@ try {
[int]$global:Files = 0 [int]$global:Files = 0
[int]$global:Bytes = 0 [int]$global:Bytes = 0
ListDir $DirTree 0 ListDir $DirTree 0
"(Total: $($global:Dirs) folders, $($global:Files) files, $($global:Bytes) bytes)" " ($($global:Dirs) folders, $($global:Files) files, $($global:Bytes) bytes in total)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -17,16 +17,16 @@ param([string]$searchPattern = "*")
function GetFileIcon { param([string]$suffix) function GetFileIcon { param([string]$suffix)
switch ($suffix) { switch ($suffix) {
".csv" { return "📊" } ".conf" {return "⚙️"}
".epub" { return "📓" } ".csv" {return "📊"}
".gif" { return "🎨" } ".epub" {return "📓"}
".iso" { return "📀" } ".gif" {return "📸"}
".jpg" { return "🎨" } ".iso" {return "📀"}
".mp3" { return "🎵" } ".jpg" {return "📸"}
".mp4" { return "🎬" } ".mp3" {return "🎵"}
".mkv" { return "🎬" } ".mkv" {return "🎬"}
".ps1" { return "📑" } ".zip" {return "📦"}
default { return "📄" } default {return "📄"}
} }
} }