mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 13:04:59 +02:00
Add open-one-drive-folder.ps1
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Opens the user's Dropbox folder
|
||||
Opens the Dropbox folder
|
||||
.DESCRIPTION
|
||||
This script launches the File and showing the user's Dropbox folder.
|
||||
This script launches the File Explorer with the user's Dropbox folder.
|
||||
.EXAMPLE
|
||||
PS> ./open-dropbox-folder
|
||||
.NOTES
|
||||
@ -12,12 +12,12 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$TargetDir = resolve-path "$HOME/Dropbox"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
throw "Dropbox folder at 📂$TargetDir doesn't exist (yet)"
|
||||
$TargetDirs = resolve-path "$HOME/Dropbox*"
|
||||
foreach($TargetDir in $TargetDirs) {
|
||||
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
|
||||
exit 0 # success
|
||||
}
|
||||
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
|
||||
exit 0 # success
|
||||
throw "No Dropbox folder at 📂$HOME/Dropbox"
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
|
Reference in New Issue
Block a user