Add open-one-drive-folder.ps1

This commit is contained in:
Markus Fleschutz
2021-11-30 14:57:46 +01:00
parent c5a3bf0608
commit 710ff06e9d
5 changed files with 32 additions and 38 deletions

View File

@ -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