mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-17 16:11:22 +02:00
Rename list-dir.ps1 to list-folder.ps1
This commit is contained in:
@ -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))"
|
@ -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
|
||||
|
Reference in New Issue
Block a user