Rename to list-dir-tree.ps1

This commit is contained in:
Markus Fleschutz 2021-04-16 17:22:26 +02:00
parent 5694bced66
commit 4de2d69d8f
3 changed files with 7 additions and 10 deletions

View File

@ -69,6 +69,7 @@ list-cheat-sheet.ps1, lists the PowerShell cheat sheet
list-commits.ps1, lists all commits in the current/given Git repository list-commits.ps1, lists all commits in the current/given Git repository
list-current-timezone.ps1, lists the current time zone details list-current-timezone.ps1, lists the current time zone details
list-clipboard.ps1, lists the contents of the clipboard list-clipboard.ps1, lists the contents of the clipboard
list-dir-tree.ps1, lists a directory tree
list-drives.ps1, lists all drives list-drives.ps1, lists all drives
list-environment-variables.ps1, lists all environment variables list-environment-variables.ps1, lists all environment variables
list-empty-dirs.ps1, lists empty subfolders within the given directory tree list-empty-dirs.ps1, lists empty subfolders within the given directory tree
@ -139,7 +140,6 @@ set-timer.ps1, sets a timer for a countdown
set-wallpaper.ps1, sets the given image as wallpaper set-wallpaper.ps1, sets the given image as wallpaper
SHA1.ps1, prints the SHA1 checksum of the given file SHA1.ps1, prints the SHA1 checksum of the given file
SHA256.ps1, prints the SHA256 checksum of the given file SHA256.ps1, prints the SHA256 checksum of the given file
show-dir-tree.ps1, visualizes the given/current directory tree
simulate-matrix.ps1, simulates the Matrix (fun) simulate-matrix.ps1, simulates the Matrix (fun)
simulate-presence.ps1, simulates the human presence against burglars simulate-presence.ps1, simulates the human presence against burglars
speak-countdown.ps1, starts a countdown by text-to-speech (TTS) speak-countdown.ps1, starts a countdown by text-to-speech (TTS)

1 Script Description
69 list-commits.ps1 lists all commits in the current/given Git repository
70 list-current-timezone.ps1 lists the current time zone details
71 list-clipboard.ps1 lists the contents of the clipboard
72 list-dir-tree.ps1 lists a directory tree
73 list-drives.ps1 lists all drives
74 list-environment-variables.ps1 lists all environment variables
75 list-empty-dirs.ps1 lists empty subfolders within the given directory tree
140 set-wallpaper.ps1 sets the given image as wallpaper
141 SHA1.ps1 prints the SHA1 checksum of the given file
142 SHA256.ps1 prints the SHA256 checksum of the given file
show-dir-tree.ps1 visualizes the given/current directory tree
143 simulate-matrix.ps1 simulates the Matrix (fun)
144 simulate-presence.ps1 simulates the human presence against burglars
145 speak-countdown.ps1 starts a countdown by text-to-speech (TTS)

View File

@ -102,6 +102,7 @@ Mega Collection of PowerShell Scripts
* [go-root.ps1](Scripts/go-root.ps1) - go to the root directory (C:\ on Windows) * [go-root.ps1](Scripts/go-root.ps1) - go to the root directory (C:\ on Windows)
* [go-scripts.ps1](Scripts/go-scripts.ps1) - go to the PowerShell Scripts folder * [go-scripts.ps1](Scripts/go-scripts.ps1) - go to the PowerShell Scripts folder
* [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file * [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file
* [list-dir-tree.ps1](Scripts/list-dir-tree.ps1) - lists a directory tree
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree * [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree
* [list-empty-files.ps1](Scripts/list-empty-files.ps1) - lists empty files within the given directory tree * [list-empty-files.ps1](Scripts/list-empty-files.ps1) - lists empty files within the given directory tree
* [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder * [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder
@ -115,7 +116,6 @@ Mega Collection of PowerShell Scripts
* [search-files.ps1](Scripts/search-files.ps1) - searches the given pattern in the given files * [search-files.ps1](Scripts/search-files.ps1) - searches the given pattern in the given files
* [SHA1.ps1](Scripts/SHA1.ps1) - prints the SHA1 checksum of the given file * [SHA1.ps1](Scripts/SHA1.ps1) - prints the SHA1 checksum of the given file
* [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file * [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file
* [show-dir-tree.ps1](Scripts/show-dir-tree.ps1) - visualizes the given/current directory tree
* [upload-file.ps1](Scripts/zip-dir.ps1) - uploads the local file to the given FTP server * [upload-file.ps1](Scripts/zip-dir.ps1) - uploads the local file to the given FTP server
* [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given directory * [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given directory

View File

@ -1,14 +1,14 @@
#!/usr/bin/pwsh #!/usr/bin/pwsh
<# <#
.SYNTAX show-dir-tree.ps1 [<dir-tree>] .SYNTAX list-dir-tree.ps1 [<dir-tree>]
.DESCRIPTION visualizes the given/current directory tree .DESCRIPTION lists a directory tree
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0 .NOTES Author: Markus Fleschutz / License: CC0
#> #>
param($DirTree = "") param($DirTree = "$PWD")
function VisualizeDirectory { param([string]$Directory, [int]$Depth) function ListDir { param([string]$Directory, [int]$Depth)
$Depth++ $Depth++
$Items = get-childItem -path $Directory $Items = get-childItem -path $Directory
foreach ($Item in $Items) { foreach ($Item in $Items) {
@ -31,12 +31,9 @@ function VisualizeDirectory { param([string]$Directory, [int]$Depth)
} }
try { try {
if ($DirTree -eq "") {
$DirTree = "$PWD"
}
$global:NumDirs = 1 $global:NumDirs = 1
$global:NumBytes = 0 $global:NumBytes = 0
VisualizeDirectory $DirTree 0 ListDir $DirTree 0
write-host "($($global:NumDirs) dirs, $($global:NumBytes) bytes total)" write-host "($($global:NumDirs) dirs, $($global:NumBytes) bytes total)"
exit 0 exit 0
} catch { } catch {