Folder Synchronization

Diffoniq can synchronize two folders — interactively from a directory comparison, or headless from the command line for scripts and the Windows Task Scheduler. In both cases the same compare engine as the interactive directory comparison (including the persistent hash cache and rename/move detection) decides what to do, then a plan of copy, rename and delete operations is carried out. For driving /sync from scripts or an AI assistant, see Scripting and AI Assistants.

The Synchronize dialog

In a folder comparison, File > Synchronize... opens a preview built from the comparison already on screen — no second scan. Pick the mode (Mirror or Update, see below), the direction (left to right or right to left) and the deletion policy; the action list and the summary line follow immediately. Execute carries out exactly the listed actions with a progress dialog that can be canceled between actions; afterwards the comparison is refreshed from disk.

Command line (/sync)

The headless twin of the dialog — it reports through an exit code and a log file (started through DiffoniqC.exe, the log lines also appear in the console):

Diffoniq /sync <left> <right> (--mirror | --update)
        [--execute] [--content] [--reverify] [--permanent] [--gitignore]
        [--format json --out <file>|- [--max-entries <n>] [--offset <n>]]
        [--exclude <patterns>] [--defaults] [--skip-online-only] [--progress] [--log <file>] [compare switches]

From a script, call DiffoniqC.exe: Diffoniq.exe is a windowed program, so a shell neither waits for it nor sees its exit code. The console launcher DiffoniqC.exe next to it takes the same arguments, waits, prints the log lines and returns the exit code (Scripting and AI Assistants). Ctrl+C there stops the sync, also mid-way through --execute. The log file is written to a temporary name and appears only when the run is complete.

/sync, -sync and --sync are the same. Use --sync in Git Bash, which rewrites a leading slash into a path: /sync arrives there as C:/Program Files/Git/sync, and Diffoniq opens its window to compare that path instead of synchronizing.

Modes

--mirrorThe right folder becomes a mirror of the left one: new and changed files are copied, files existing only on the right are deleted, and files recognized as renamed or moved are renamed on the right instead of being copied again.
--updateCopy only: new and changed files go left → right. Nothing is ever deleted or renamed on the right.

On the command line the direction is always left → right; to synchronize the other way, swap the two path arguments. Both paths must be folders — archives can be compared and viewed, but not used as a synchronization root.

Safety

The plan as JSON

For a script, the dry run can also write its plan as one JSON document: --format json --out plan.json, or --out - for the standard output (the log lines then go to the standard error). The document names both roots, the mode and the criterion, counts every operation in summary (makeDir, rename, copyNew, copyChanged, delete, skip, onlineOnly, bytesToCopy) and lists them in actions, each with its action, the target below the right root and, where there is one, the source, the bytes to copy or the reason for a skip. --max-entries limits the list; omitted says how many operations it left out, and --offset skips the first operations for the next page (skipped). The JSON describes the dry run only and is refused together with --execute.

What counts as “changed”

By default a file pair is compared the quick way — by size and timestamp: a file whose size or last-write time differs counts as changed. Timestamps up to 2 seconds apart count as equal, because FAT drives (many USB sticks) store them in 2-second steps. The window's Ignore Date and Ignore Time settings do not apply here — their factory setting would reduce the check to the size alone and miss an edited file of unchanged size. To ignore timestamps deliberately, say so on the command line (/g t, see Command Line); a size difference is always a change unless Ignore Size is set. With --content the decision is made by file content instead: equal-sized pairs are hash-verified, so a touched-but-identical file is not copied and a same-size/same-date change is still caught. Repeat runs — the scheduler scenario — resolve those hashes from the hash cache almost for free. The cache trusts a file whose size and timestamp did not change; --reverify (implies --content) reads every equal-sized pair again, like Re-verify Contents in the window.

The other settings of the window — for example Ignore Case or the subfolder depth — do apply. --defaults plans with the factory settings instead, so a script gets the same plan on every machine; compare switches on the command line still apply on top. --exclude "*.bak;tmp" leaves files and folders matching these wildcard patterns out on both sides, like the Exclude fields: they are neither copied nor, in a mirror, deleted. --skip-online-only keeps --content from downloading files that a cloud service keeps online only: such a pair is skipped (reason onlineOnly) instead of being read. Recognized are the attributes of the Windows cloud files API, which OneDrive, Dropbox and other providers set, and a whole drive labelled Google Drive, because Google Drive in streaming mode sets none of them: with the switch every --content pair of that side is skipped, and the JSON plan marks the root with cloudDrive. A renamed drive is not recognized; its files are then read, and downloaded, like ordinary files. --progress writes progress lines to standard error while the folders are listed and read, as described for /report.

Result: exit code and log

The result of /sync is the process exit code plus a log file — ideal for schedulers, which capture exactly these two things. Started through DiffoniqC.exe, the log lines also appear in the console:

0No differences — nothing to do
1Differences found; dry run: reported · with --execute: synchronized successfully
2Finished with errors (partially synchronized)
3Invalid arguments, or aborted before any operation

The log is written to %APPDATA%\Diffoniq\sync\sync_YYYYMMDD_HHMMSS.log (the 30 newest logs are kept) unless --log <file> names a different location.

Scheduling a nightly sync

Create a scheduled task that runs the sync every night at 02:30:

schtasks /create /tn "Nightly backup sync" /sc daily /st 02:30 ^
  /tr "\"C:\Program Files\Diffoniq\Diffoniq.exe\" /sync D:\work \\nas\backup\work --mirror --execute --log D:\logs\work-sync.log"

Tip: run the same command once without --execute and review the dry-run log before arming the task.

Licensing

Synchronizing does not need a license: dry run and --execute work the same in the trial. The log of every run names the license it saw (license: none (evaluation) on an unlicensed copy) — no dialog, no exit code, nothing interrupts a scheduled run. Up to version 2.2, --execute without a license ended with exit code 3 and did nothing.