mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-30 15:08:49 +02:00
Updated some cd-* scripts
This commit is contained in:
parent
19d3eefe57
commit
98193700a9
@ -5,7 +5,7 @@
|
||||
This PowerShell script changes the working directory to the user's Dropbox folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-dropbox
|
||||
📂C:\Users\Markus\Dropbox (has 2 files and 4 subfolders)
|
||||
📂C:\Users\Markus\Dropbox (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -14,13 +14,13 @@
|
||||
|
||||
try {
|
||||
if (-not(Test-Path "~/Dropbox" -pathType container)) {
|
||||
throw "No 📂Dropbox folder in your home directory - is Dropbox installed?"
|
||||
throw "No 'Dropbox' folder in your home directory - is Dropbox installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/Dropbox"
|
||||
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 entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
@ -5,7 +5,7 @@
|
||||
This PowerShell script changes the working directory to the /etc directory.
|
||||
.EXAMPLE
|
||||
PS> ./cd-etc
|
||||
📂C:\Windows\System32\drivers\etc (has 2 files and 3 subfolders)
|
||||
📂C:\Windows\System32\drivers\etc (has 5 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -19,12 +19,12 @@ try {
|
||||
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||
}
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No /etc directory at 📂$path"
|
||||
throw "No 'etc' folder found at: $path"
|
||||
}
|
||||
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 entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
@ -5,7 +5,7 @@
|
||||
This PowerShell script changes the working directory to the user's NextCloud folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-nextcloud
|
||||
📂C:\Users\Markus\NextCloud entered (has 2 files and 3 subfolders)
|
||||
📂C:\Users\Markus\NextCloud entered (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -13,14 +13,14 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$path = Resolve-Path "~/NextCloud"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No NextCloud folder at $path - is NextCloud installed?"
|
||||
if (-not(Test-Path "~/NextCloud" -pathType container)) {
|
||||
throw "No 'NextCloud' folder in your home directory - is NextCloud installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/NextCloud"
|
||||
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 entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
@ -5,7 +5,7 @@
|
||||
This PowerShell script changes the working directory to the user's OneDrive folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-onedrive
|
||||
📂C:\Users\Markus\OneDrive entered (has 2 files and 3 subfolders)
|
||||
📂C:\Users\Markus\OneDrive entered (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -13,14 +13,14 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$path = Resolve-Path "~/OneDrive"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "No OneDrive folder at $path - is OneDrive installed?"
|
||||
if (-not(Test-Path "~/OneDrive" -pathType container)) {
|
||||
throw "No 'OneDrive' folder in your home directory - is OneDrive installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/OneDrive"
|
||||
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 entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
@ -5,7 +5,7 @@
|
||||
This PowerShell script changes the working directory to the user's Syncthing folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-sync.ps1
|
||||
📂C:\Users\Markus\Sync entered (has 2 files and 3 subfolders)
|
||||
📂C:\Users\Markus\Sync entered (has 2 files and 0 folders)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -14,13 +14,13 @@
|
||||
|
||||
try {
|
||||
if (-not(Test-Path "~/Sync" -pathType container)) {
|
||||
throw "Your home folder has no Sync folder - is Syncthing installed?"
|
||||
throw "No 'Sync' folder in your home directory - is Syncthing installed?"
|
||||
}
|
||||
$path = Resolve-Path "~/Sync"
|
||||
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 entered (has $($files.Count) files and $($folders.Count) folders)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
Loading…
x
Reference in New Issue
Block a user