In order to facilitate using FreeFileSync and RealtimeSync in advanced synchronization scenarios, creating batch files is a good way to provide additional functionality. The following section will give some general hints for custom *.cmd and *.bat files.
Example: (A simple locking facility when sync'ing with multiple computers in parallel)
:tryAgain
if not exist
\\share\folder\lock (
::create
the lock
echo
This is a lock file > \\share\folder\lock
::execute
the synchronization batch job synchronously
"C:\Program
Files\FreeFileSync\FreeFileSync.exe"
"C:\MySyncJob.ffs_batch"
del
\\share\folder\lock
) else (
::wait
5 seconds then try starting sync again:
choice
/C:AB /T:5 /D:A > NUL
goto tryAgain
)
When starting a batch file from RealtimeSync be sure to make synchronous calls to FreeFileSync only. This will prevent RealtimeSync from detecting changes while synchronization is still in progress.
During execution of a Batch file a black console window is shown. You can hide this window by using the Visual Basic script "Invisible.vbs" located in the FreeFileSync installation directory.
Usage:
wscript C:\Program
files\FreeFileSync\Invisible.vbs C:\MyBatchFile.cmd
FreeFileSync returns with an Errorlevel below zero if unresolved problems remain:
"C:\Program
Files\FreeFileSync\FreeFileSync.exe"
"H:\Silent_Config.ffs_batch"
if not errorlevel 0
(
::if
something went wrong, add special treatment here
echo
Errors occurred during synchronization...
pause
)