FreeFileSync Open Source File Synchronization

About Tutorials Screenshots Vision Download Archive Forum F.A.Q. Manual Donate
It looks like an ad blocker has blocked the ads. Donate now The FreeFileSync project is 100% dependent on ad revenue and donations to stay alive. Instead of the ads, and after FreeFileSync has proven useful to you, please think about supporting with a donation.
FreeFileSync User Manual:

Scripting

When FreeFileSync is run via command line, the synchronization result is written to standard output in JSON format. This can be evaluated by scripts to customize functionality.

Windows: To view FreeFileSync's standard output, the pipe (|) operator is required because the operating system classifies FreeFileSync as a GUI application rather than a console application:
FreeFileSync.exe "D:\Backup Projects.ffs_batch" | more
The command prints JSON data such as:
{
  "syncResult": "success",     → can be: success, warning, error, cancelled
  "startTime": "2025-11-20T10:00:42+00:00",
  "totalTimeSec": 12,
  "errors": 0,
  "warnings": 0,
  "totalItems": 1000,
  "totalBytes": 1024,
  "processedItems": 1000,
  "processedBytes": 1024,
  "logFile": "D:\\Logs\\Backup Projects 2025-11-20 100042.123.html"
}

Parsing sync result via PowerShell

Windows batch scripts (.cmd/.bat) cannot parse JSON, so PowerShell can be used instead:

Example: Delete unnecessary log files
#run an .ffs_batch config and parse JSON output
$data = & "C:\Program Files\FreeFileSync\FreeFileSync.exe" "D:\Backup Projects.ffs_batch" | ConvertFrom-Json

#delete the log file if no items were synced
if ($data.syncResult -eq "success" -and $data.totalItems -eq 0)
    Remove-Item $data.logFile

Parsing sync result via Python

On Linux, the same task can be implemented using Python:
#!/usr/bin/env python3

import json, subprocess, os

#run an .ffs_batch config and parse JSON output
result = subprocess.run(
    ["/opt/FreeFileSync/FreeFileSync", "/home/zenju/Backup Projects.ffs_batch"], stdout=subprocess.PIPE, text=True)

data = json.loads(result.stdout)

#delete the log file if no items were synced
if data["syncResult"] == "success" and data["totalItems"] == 0:
    os.remove(data["logFile"])