Updated cd-downloads.ps1

This commit is contained in:
Markus Fleschutz 2025-04-23 12:32:13 +02:00
parent f027e1f914
commit 257c2c3d82

View File

@ -13,13 +13,16 @@
#>
try {
if ($IsLinux) {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Downloads" -pathType container)) {
throw "No downloads folder at ~/Downloads yet"
}
$path = Resolve-Path "~/Downloads"
} else {
$path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
}
if (-not(Test-Path "$path" -pathType container)) {
throw "No downloads folder at 📂$path"
if (-not(Test-Path "$path" -pathType container)) {
throw "No downloads folder at 📂$path"
}
}
Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory