Hi all,
I want to share a code to navigate to the JD system directory through Windows Powershell. I used as a starting point a code example from this forum (I think it was here) used in the Bash terminal.
function cdj {
param (
[string]$folderName
)
# Update with your documents root folder
$rootPath = "D:\Cloud\OneDrive"
# List of directories matching pattern
$matchingDirs = Get-ChildItem -Path $rootPath -Directory -Recurse | Where-Object { $_.Name -like "*$folderName*" }
# Checks for matches
if ($matchingDirs.Count -eq 0) {
Write-Host "No matching directories found for '$folderName'."
return
}
# If there is only one match, navigate to it
if ($matchingDirs.Count -eq 1) {
Set-Location -Path $matchingDirs[0].FullName
} else {
# If there are multiple matches, list them
Write-Host "Multiple matching directories found for '$folderName':"
$matchingDirs | ForEach-Object { Write-Host $_.FullName }
}
}
Code in https://gist.github.com/maxwellamaral/0204d6e833eb02bd6ba5f8824e6598e4