Rename list-dir.ps1 to list-folder.ps1

This commit is contained in:
Markus Fleschutz
2021-10-10 10:25:48 +02:00
parent 1e20cb74ce
commit 00ba134682
4 changed files with 10 additions and 9 deletions

View File

@ -1,11 +1,12 @@
<#
.SYNOPSIS
Lists the directory content formatted in columns
Lists the folder content
.DESCRIPTION
list-dir.ps1 [<SearchPattern>]
<SearchPattern> is "*" (anything) by default
This script lists the directory content formatted in columns.
.PARAMETER SearchPattern
Specifies the search pattern, "*" by default (means anything)
.EXAMPLE
PS> ./list-dir C:\
PS> ./list-folder C:\
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
@ -14,7 +15,7 @@
param([string]$SearchPattern = "*")
function ListDir { param([string]$SearchPattern)
function ListFolder { param([string]$SearchPattern)
$Items = get-childItem -path "$SearchPattern"
foreach ($Item in $Items) {
$Name = $Item.Name
@ -29,7 +30,7 @@ function ListDir { param([string]$SearchPattern)
}
try {
ListDir $SearchPattern | format-wide -autoSize
ListFolder $SearchPattern | format-wide -autoSize
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"

View File

@ -23,6 +23,6 @@ del alias:pwd -force -errorAction SilentlyContinue
set-alias -name pwd -value list-workdir.ps1 # pwd = print working directory
set-alias -name ll -value get-childitem # ll = list long
del alias:ls -force -errorAction SilentlyContinue
set-alias -name ls -value list-dir.ps1
set-alias -name ls -value list-folder.ps1
set-alias -name .. -value cd-up.ps1 # 1 dir level up
set-alias -name ... -value cd-up2.ps1 # 2 dir levels up