diff --git a/Data/scripts.csv b/Data/scripts.csv index 11902ff0..b5f33907 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -67,7 +67,6 @@ list-automatic-variables.ps1, lists the automatic variables of PowerShell list-branches.ps1, lists all branches in the current/given Git repository 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 @@ -101,6 +100,7 @@ list-sql-tables.ps1, lists the SQL server tables list-system-info.ps1, lists system information on the local computer list-tags.ps1, lists all tags in the current/given Git repository list-tasks.ps1, lists all Windows scheduler tasks +list-timezone.ps1, lists the current time zone details list-timezones.ps1, lists all time zones available list-user-groups.ps1, lists the user groups on the local computer locate-city.ps1, prints the geographic location of the given city diff --git a/README.md b/README.md index 25f6b23b..4d2b6089 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ Mega Collection of PowerShell Scripts * [install-google-chrome.ps1](Scripts/install-google-chrome.ps1) - installs the Google Chrome browser * [list-drives.ps1](Scripts/list-drives.ps1) - lists all drives * [list-network-shares.ps1](Scripts/list-network-shares.ps1) - lists the network shares of the local computer -* [list-current-timezone.ps1](Scripts/list-current-timezone.ps1) - lists the current time zone details * [list-installed-apps.ps1](Scripts/list-installed-apps.ps1) - lists the installed Windows Store apps * [list-installed-software.ps1](Scripts/list-installed-software.ps1) - lists the installed software (except Windows Store apps) * [list-printers.ps1](Scripts/list-printers.ps1) - lists all printer known to the computer @@ -54,6 +53,7 @@ Mega Collection of PowerShell Scripts * [list-services.ps1](Scripts/list-services.ps1) - lists the services on the local computer * [list-system-info.ps1](Scripts/list-system-info.ps1) - lists system information on the local computer * [list-tasks.ps1](Scripts/list-tasks.ps1) - lists all Windows scheduler tasks +* [list-timezone.ps1](Scripts/list-timezone.ps1) - lists the current time zone details * [list-timezones.ps1](Scripts/list-timezones.ps1) - lists all time zones available * [list-user-groups.ps1](Scripts/list-user-groups.ps1) - lists the user groups on the local computer * [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (needs admin rights) diff --git a/Scripts/list-empty-dirs.ps1 b/Scripts/list-empty-dirs.ps1 index 66536b66..f50e3d18 100755 --- a/Scripts/list-empty-dirs.ps1 +++ b/Scripts/list-empty-dirs.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/pwsh <# .SYNTAX list-empty-dirs.ps1 [] .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])" diff --git a/Scripts/list-hidden-files.ps1 b/Scripts/list-hidden-files.ps1 index f4931734..ac357f60 100755 --- a/Scripts/list-hidden-files.ps1 +++ b/Scripts/list-hidden-files.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/pwsh <# .SYNTAX list-hidden-files.ps1 [] .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])" diff --git a/Scripts/list-current-timezone.ps1 b/Scripts/list-timezone.ps1 similarity index 84% rename from Scripts/list-current-timezone.ps1 rename to Scripts/list-timezone.ps1 index cfa2611a..bc5d795f 100755 --- a/Scripts/list-current-timezone.ps1 +++ b/Scripts/list-timezone.ps1 @@ -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 diff --git a/Scripts/next-joke.ps1 b/Scripts/next-joke.ps1 index 6acc3748..4b1083f5 100755 --- a/Scripts/next-joke.ps1 +++ b/Scripts/next-joke.ps1 @@ -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])"