Rename to list-timezone.ps1

This commit is contained in:
Markus Fleschutz
2021-04-17 18:38:38 +02:00
parent 370fe6c7dc
commit 9aa997ebf5
6 changed files with 19 additions and 27 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX list-empty-dirs.ps1 [<dir-tree>]
.DESCRIPTION lists empty subfolders within the given directory tree
@ -6,20 +6,17 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($DirTree = "")
if ($DirTree -eq "" ) {
$DirTree = read-host "Enter the path to the directory tree"
}
param($DirTree = "$PWD")
try {
$DirTree = resolve-path "$DirTree/"
write-progress "Listing empty directories in $DirTree..."
[int]$Count = 0
Get-ChildItem $DirTree -attributes Directory -recurse | Where {$_.GetFileSystemInfos().Count -eq 0} | ForEach-Object {
write-output $_.FullName
Get-ChildItem "$DirTree" -attributes Directory -recurse | Where {$_.GetFileSystemInfos().Count -eq 0} | ForEach-Object {
"📂 $($_.FullName)"
$Count++
}
write-host -foregroundColor green "OK - found $Count empty directories"
"✔️ directory tree $DirTree has $Count empty directories"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX list-hidden-files.ps1 [<dir-tree>]
.DESCRIPTION lists hidden files within the given directory tree
@ -6,20 +6,17 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($DirTree = "")
if ($DirTree -eq "" ) {
$DirTree = read-host "Enter the path to the directory tree"
}
param($DirTree = "$PWD")
try {
$DirTree = resolve-path "$DirTree/"
[int]$Count = 0
write-progress "Listing hidden files in $DirTree ..."
get-childItem $DirTree -attributes Hidden -recurse | foreach-object {
write-output $_.FullName
get-childItem "$DirTree" -attributes Hidden -recurse | foreach-object {
"📄 $($_.FullName)"
$Count++
}
write-host -foregroundColor green "OK - found $Count hidden file(s)"
"✔️ directory tree $DirTree has $Count hidden file(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,6 +1,6 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX list-current-timezone.ps1
.SYNTAX list-timezone.ps1
.DESCRIPTION lists the details of the current time zone
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX next-joke.ps1
.DESCRIPTION gets the next random Juck Norris joke
@ -7,15 +7,13 @@
#>
try {
$PathToRepo = "$PSScriptRoot/.."
$Table = import-csv "$PathToRepo/Data/jokes.csv"
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,66)
$Joke = $Table[$Index].Joke
write-output "$Joke"
"📣 $Joke"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"