mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 01:43:37 +01:00
Rename to list-dir-tree.ps1
This commit is contained in:
parent
5694bced66
commit
4de2d69d8f
@ -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-current-timezone.ps1, lists the current time zone details
|
||||
list-clipboard.ps1, lists the contents of the clipboard
|
||||
list-dir-tree.ps1, lists a directory tree
|
||||
list-drives.ps1, lists all drives
|
||||
list-environment-variables.ps1, lists all environment variables
|
||||
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
|
||||
SHA1.ps1, prints the SHA1 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-presence.ps1, simulates the human presence against burglars
|
||||
speak-countdown.ps1, starts a countdown by text-to-speech (TTS)
|
||||
|
|
@ -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-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
|
||||
* [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-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
|
||||
@ -115,7 +116,6 @@ Mega Collection of PowerShell Scripts
|
||||
* [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
|
||||
* [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
|
||||
* [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given directory
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX show-dir-tree.ps1 [<dir-tree>]
|
||||
.DESCRIPTION visualizes the given/current directory tree
|
||||
.SYNTAX list-dir-tree.ps1 [<dir-tree>]
|
||||
.DESCRIPTION lists a directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.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++
|
||||
$Items = get-childItem -path $Directory
|
||||
foreach ($Item in $Items) {
|
||||
@ -31,12 +31,9 @@ function VisualizeDirectory { param([string]$Directory, [int]$Depth)
|
||||
}
|
||||
|
||||
try {
|
||||
if ($DirTree -eq "") {
|
||||
$DirTree = "$PWD"
|
||||
}
|
||||
$global:NumDirs = 1
|
||||
$global:NumBytes = 0
|
||||
VisualizeDirectory $DirTree 0
|
||||
ListDir $DirTree 0
|
||||
write-host "($($global:NumDirs) dirs, $($global:NumBytes) bytes total)"
|
||||
exit 0
|
||||
} catch {
|
Loading…
Reference in New Issue
Block a user