Operating ffs_batch from a batch file

Get help for specific problems
Posts: 4
Joined: 20 Mar 2019

adarbaton

Dear Zenju, first of all thank you for a wonderful software!
I created a DOS script that runs FFS. The main reason for using it is the need to send results (both OK or ERROR) by email with the log file attached. I will share the script with the community once I am happy with it. But I have got a question regarding retention period, i.e. "Last x days" parameter.
Preamble: I decided to define source and destination locations within the batch file and then call FFS with the command of shape:
"C:\Program Files\FreeFileSync\FreeFileSync.exe" %FFSProfile% -dirpair "%Source%" "%Destination%"
Where %FFSProfile% is the path to a predefined universal profile with an empty Source and Destination fields. This profile also contains the following line to specify location for previous file versions:
%Destination%\_modified\%Target%
This works fine, that means that I am able to use variables defined in the batch file within FFS GUI.
Question 1: I want to be able to define retention period in the batch file. How can I pass last_x_days parameter to the FFS profile? I was trying to edit ffs_batch file in text editor with no success. Is there any other way?
If not possible, can I define retention period within FFS GUI and call the profile with the same command above? It didn't work for me either. I.e. I can't use "Last x days" feature if I call ffs_batch this way.
Question 2: Is there any way to predefine log file name or to know it after completion of backup operation? (currently I am running a DOS loop that finds the most recent file in logs folder)
User avatar
Site Admin
Posts: 7285
Joined: 9 Dec 2007

Zenju

>Q1
If you get the syntax right (you can test by creating a ffs_batch file via GUI and observe the changes in an editor), there's no reason why this shouldn't work.

>Q2
Not sure how useful this is, but FFS sets the %logfile_path% environment variable before calling the "on completion" command. I believe the scope is "per process tree", so it probably cannot be observed from a calling batch script.
Posts: 4
Joined: 20 Mar 2019

adarbaton

Great thanks, Zenju! The idea to use -edit flag to observe the actual settings is valuable. I am still testing the setup.
Posts: 4
Joined: 20 Mar 2019

adarbaton

Tested, works: I can set MaxAge in a blank profile and call the program with:
"C:\Program Files\FreeFileSync\FreeFileSync.exe" %FFSProfile% -dirpair "%Source%" "%Destination%"
and it works properly removing aged files.

But I have to report a (minor) bug:
Old files will not be removed from VersioningFolder if there is nothing to synchronize in the source/destination folders! (OMG, how much time I lost running operation under different conditions before I found out why aged files are not removed! :))) )
User avatar
Site Admin
Posts: 7285
Joined: 9 Dec 2007

Zenju

Hm, I'm a bit undecided on whether this is a bug or not. It certainly is supposed to be a feature, but it's always bad when it accidentally looks like a bug due to not being transparent on what can be expected.
Posts: 4
Joined: 20 Mar 2019

adarbaton

I agree that this is questionable whether or not it is a bug. In my personal view, I'd like to get rid of aged files with no connection to whether or not there is something to synchronize. But this is up to you. I took my lesson :) Thank you again for a wonderful peace of software! I will find a way to donate something if I find an international credit card (I'm in India...)