How to open path in Double Commander from Terminal

Solution 1:

By default Double Commander is programmed to open with two Tabs each set to the current location of the Double Commander.app application bundle. If one then changes to a different location other then the default on one of the Tabs and then closes Double Commander and reopens it, it opens to the last location before being closed.

Here's a way to open Double Commander to a specific path from the command line similar to opening Finder to a specific path using Terminal. This covers the default of two Tabs.

Use the following syntax in a Terminal:

open -a Double\ Commander --args -path location ...

Example:

open -a Double\ Commander --args -path ~/Documents

This will open Double Commander to your Documents folder in the left Tab and the right Tab will open to the last location opened.

If you want to set the location of the both Tabs use:

open -a Double\ Commander --args -path location location

Example:

open -a Double\ Commander --args -path / ~/Documents 

This will open Double Commander to the root of the boot volume, typically Macintosh HD, in the left Tab and your Documents folder in the right Tab.

If there is a way to set just the right Tab while letting the left Tab default to the last saved location I do not know the syntax for it, if it's even doable. I did try several attempts using different delimiters but none gave the wanted results in testing.


Update to address the comment by s.newave:

I'd add a function to your .bash_profile file as in the following example code:

function odc () {
        pkill doublecmd; open -a Double\ Commander --args --no-splash -path "$1" "$2"
 }

Then from the command line in Terminal you can simply use odc or e.g.: odc / ~Documents

Note that if the Double Commander > Configuration > Behaviors > [] Allow only one copy of DC at a time, check box is not checked, you can use the following variant to open a new occurrence of Double Commander to the desired paths leaving other occurrences of Double Commander running.

function ondc () {
        open -n -a Double\ Commander --args --no-splash -path "$1" "$2"
 }

Then from the command line in Terminal you can simply use ondc or e.g.: ondc / ~Documents

Note that in either case you can also pass a single argument as well, e.g. odc ~Documents or: ondc ~Documents

The function names odc and ondc stand for open double commander and open new double commander, respectively.