Create textfile in destination after sync is done

Get help for specific problems
Posts: 1
Joined: 20 Sep 2020

147852369

Hi,

I use FreeFileSync since years and now I want to optimize my workflow.

Is it possible to create a textfile in the destination folder when sync is done?
Image


The filename should look like this: 2020-09-20_(22-23-06)-freefilesyncdone.txt

I started to write a batchfile:
@ECHO OFF
:: This batch file creates a file with a timestamp after sync with FreeFileSync is completed.

:: delete old file
:: TODO: How can I delete old files with prefix -"freefilesyncdone" in sync destination?

:: determine current date for filename
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set DateTime=%%a
set Yr=%DateTime:~0,4%
set Mon=%DateTime:~4,2%
set Day=%DateTime:~6,2%
set Hr=%DateTime:~8,2%
set Min=%DateTime:~10,2%
set Sec=%DateTime:~12,2%

:: create filename
set myFileName=%Yr%-%Mon%-%Day%_(%Hr%-%Min%-%Sec%)
set suffix="-freefilesyncdone"

:: create filename
echo. 2>%myFileName%%suffix%.txt

:: TODO: How can I create this file in the sync destination?
Is it possible to give this batch file arguments from FreeFileSync GUI? I need the sync destination.

Thank you
User avatar
Posts: 2947
Joined: 22 Aug 2012

Plerry

You can try using Macro's in the FFS (On Completion or On Succes) command line invoking the post-processing batch script (Never tried this).
If that does not work, try to have FFS be launched by and from your/a (e.g. *.cmd) script, using proper command-line options. You then know these parameters and can re-use those in your post-processing part.
User avatar
Posts: 4867
Joined: 11 Jun 2019

xCSxXenon

You could hard code the destination in the script, and have a copy of the script for each sync config. More clutter, but should work. Then call the corresponding script for that sync/folders