Command Line Option To Set Two Directories???

Get help for specific problems
Posts: 7
Joined: 14 Feb 2010

gbyundt

Hi,

Alternate Windows file managers such as Nomad.net or Total Commander allow you
to run external utilities with command line arguments of file or directory
names. I would like to define a utility button that runs FreeFileSync with the
two directories active in the dual pane window as the arguments.

I did the "obvious" thing and had the manager run the following command line:

freefilesync <directory full path 1> <directory full path 2>

Unfortunately FreeFileSync interprets the command line argument as a
FreeFileSync batch file. Since it is a directory and not even a file it pops
up a File does not exist error box using the first directory path command
argument.

Is there a way via the command line to set the two directory paths to be
compared with FreeFileSync? Note that these file managers are not "smart"
enough to create a batch file with the directory names and then call
FreeFileSync with the created batch file as an argument.

Thoughts?

gby
User avatar
Site Admin
Posts: 7058
Joined: 9 Dec 2007

Zenju

I have somewhat mixed feelings about accepting input data other than FFS
configuration files, which are currently the single one "interface". Neither
do I want to duplicate each means to specify the various configuration
options, nor is this possible in a proper way with he constraints of a
commandline (limited command length, lacking unicode support).

However having the possibility to pass a list of directories to ease
integration into another tool seems important enough a usecase to justify an
exception. The current command line interface is very simple, and adding this
feature can be done without negative impact on any of the other features. So
I'll give it a shot and see how it goes:

The new command line operates in two modes:
1. user passes one or multiple, mixed combinations of ffs_gui/ffs_batch files. These will be merged and FFS starts in gui mode. If a single ffs_batch is passed, FFS starts in batch mode.

2. If the first command argument is an existing directory, FFS will create a temporary configuration and unconditionally add all other arguments into a list of folder pairs and start FFS in GUI mode with sync variant set to mirror.

[404, Invalid URL: http://ifile.it/ds0an69/FreeFileSync_v4.1_beta6_setup.exe]
Posts: 22
Joined: 18 Dec 2009

grobbla

Two other solutions come to my mind.
- use environment %vars% in a customized config file, set them via batch file and launch ffs.
- use a command line xml tool to insert/remove paths in a config file, via batch file and launch ffs..
Posts: 22
Joined: 18 Dec 2009

grobbla

gby,

try it like this:

- TC launches a cmd file, with the left and right pane as arguments, use double quotes to protect spaces in paths.
- the cmd file sets the two path names.
- the cmd launches ffs with a pre made ffs_gui file as argument.

Example cmd file "viaEnviron.cmd":
###
set leftPane=%~1
set rightPane=%~2
Path\to\FreeFileSync.exe Path\to\viaEnviron.ffs_gui
###

Now create a fresh ffs_gui file, using %leftPane% and %rightPane% as left and
right dir. Save it as "viaEnviron.ffs_gui".
In TC, it could look like this: Path\to\viaEnviron.cmd "TCleftPath"
"TCrightPath".
I tried this with my favorite file manager right now, works like expected.

have fun
Posts: 7
Joined: 14 Feb 2010

gbyundt

What grobbla suggested does work as described. Thanks for the great
suggestion.

From my perspective, there was one annoyance with it. The DOS prompt box
running the CMD file showing up. A quick google search did not turn up a
trivial way to hide the DOS window. So, I used a batch/cmd file to exe
converter from http://www.f2ko.de/programs.php?lang=en&pid=b2e This program has an option to make the
application invisible. Nice small 22k file is the result. So now the DOS box
window is hidden and the FFS window shows up. Very nice.

One great characteristic of this method compared to the updated command line
suggestion by Zenju is that you can set the target viaEnviron.ffs_gui file
to have exactly the synchronization method and filters you want. Even more you
could create multiple viaEnviron.ffs_gui files with different synchronizing
options presets to have different methods! Using this idea my CMD file is now:

Updated CMD file:



set leftPane=%~1
set rightPane=%~2
"Path\To\FreeFileSync\FreeFileSync.exe" "%~3"



where the third argument to this CMD file is the desired full address to the
particular viaEnviron.ffs_gui file. Complete flexibility!

gby
User avatar
Site Admin
Posts: 7058
Joined: 9 Dec 2007

Zenju

>hide the DOS window
FFS help file contains a few tips on "Batch Scripting". Here's the one you
were looking for:

"During execution of a Windows Batch file (*.bat/*.cmd) a black console window
is shown. You can hide it using the Visual Basic script "Invisible.vbs"
located in FreeFileSync's installation directory."