# Command: Go-Relative (go to next/prev sibling folder)

**URL:** https://resource.dopus.com/t/command-go-relative-go-to-next-prev-sibling-folder/20597
**Category:** Buttons/Scripts
**Tags:** script, commands, vbscript, jscript
**Created:** [May 11, 2015, 9:17pm UTC](https://resource.dopus.com/t/command-go-relative-go-to-next-prev-sibling-folder/20597 "2015-05-11T21:17:36Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![Julianon](https://resource.dopus.com/user_avatar/resource.dopus.com/julianon/32/25802_2.png) [@Julianon](https://resource.dopus.com/u/Julianon)
#### Post date: [January 3, 2017, 5:05am UTC](https://resource.dopus.com/t/command-go-relative-go-to-next-prev-sibling-folder/20597/15 "2017-01-03T05:05:08Z")

</div>

I've taken the dangerous liberty of adding some bells and whistles to leo's script. Apologies, leo, in advance for my inevitable mistakes and misunderstandings. In particular, I'm not confident that I've understood the significance of all the checks in the code.

1. I rewrote it in JScript because I don't know VBScript, and renamed it from Go\_to\_Relative.vbs to GoRelative.js to avoid confusion with leo's script.

2. Drive-hopping is added. That is, if the script climbs to the root of a drive rather than a directory, then it will hop to the next or previous drive in alphabetical order.  
— This drivehopping ignores drives that are not ready, but otherwise does not distinguish between types of drives (one could easily add such code).  
— A new switch argument `ChooseDrive` of type /S triggers a dialogue for the user to choose the target drive, rather than have it chosen automatically.  
— Another new argument `OmitDrives` of type /K can avoid annoying things such as HP's naming of their backup drive as D: drive. For example,  
`OmitDrives=D:,M:,Z:` (`OmitDrives=D,M,Z` and `OmitDrives=D:\,M:\,Z:\` will also work).

3. More significantly, a new argument `Depth`, of type /O, allows automatic navigation through parallel directory structures. By itself or with an invalid value, it triggers a dialogue, otherwise it should have a positive whole number as its value.

- `Depth=3` extends this climb one more step.

1. For depths greater than 1, the tree-climbing may comes to a drive prematurely. In this situation, the climbing stops, and drive-hopping begins.

2. Once the depth is greater than 1, the parallel target directory may not exist. When this happens, the script goes as far back down the target tree as far as it can, then issues a warning message.

3. The `Sibling` argument is now of type /O. The chosen sibling may be 1, 2, 3, ... away, which may be useful when the depth is greater than 1.

4. The default is now to include hidden files, but exclude system files. These defaults can be changed with two switches of type /S:

5. [In a DOpus thread a year or so ago](https://resource.dopus.com/t/a-key-system-to-control-the-place-where-a-new-folder-is-opened/22089/1), I posted a system using the keys F12, F11, F10 and F9, for opening directories in another tab, the other dual panel, or another single- or dual-panel lister. These methods now work consistently with the GoRelative commands.

* * *

### Examples (without the `UserDefinedGo` switch):

`GoRelative Sibling=Next Wrap Depth=1` — Totally standard

`GoRelative Sibling=Previous Depth ChooseDrive SkipHidden` — Dialogues for the depth and the drive.

`GoRelative Sibling Wrap Depth=2 OmitDrives=M:,Z:` — Dialogue for the sibling, and Drives M: and Z: are omitted if drive-hopping is necessary.

* * *

### Installation:

The file below is the adapted GoRelative.js script. I was not sure how to handle the copyright protocols, which may well need adjusting.

First, disable the old addon Go\_to\_Relative.vbs if it is installed, otherwise DOpus will have two conflicting commands GoRelative. The easiest way is to navigate to the addons directory and rename its extension to .vbsx — this is easily reversed in the event of blunders by me.

Download the new file GoRelative.js.txt below, open the scripts window by Preferences \> Toolbars \> Scripts, and drag the downloaded file to its right-hand panel.

- [GoRelative.js.txt](https://resource.dopus.com/uploads/default/original/3X/f/e/fe3eeb94a6ca32d2cb6a27082b562899dccb18b6.txt) (14.8 KB)

---

_[View the full topic](https://resource.dopus.com/t/command-go-relative-go-to-next-prev-sibling-folder/20597)._
