Updated the cd-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2025-07-09 14:19:53 +02:00
parent d3e77308a8
commit 51b541e0de
30 changed files with 115 additions and 65 deletions

View File

@ -4,14 +4,16 @@
.DESCRIPTION
This PowerShell script changes the working directory to the user's videos folder.
.EXAMPLE
PS> ./cd-videos
📂C:\Users\Markus\Videos entered (has 3 files and 0 subfolders)
PS> ./cd-videos.ps1
📂C:\Users\Markus\Videos with 3 files and 0 folders entered.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
if ($IsLinux) {
$path = Resolve-Path "~/Videos"
@ -24,9 +26,9 @@ try {
Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
"⚠️ ERROR: $($Error[0])"
exit 1
}