How to keep two folders in sync without losing anything
One-way and two-way sync fail in completely different ways, and the one that loses data is the delete.
Short answer
Decide first whether one side is authoritative. If it is, mirror one way and think hard before enabling deletes. If both sides get edited, you need real conflict detection — and a sync tool that cannot detect a conflict will quietly resolve it by discarding somebody's work.
Answer this before anything else
Is one side the source of truth?
If yes, you want a one-way mirror: the destination is made to look like the source, and nothing anyone does at the destination survives. That is simple, predictable, and correct for backups, deployments and publishing.
If both sides get edited, you want two-way sync with real conflict detection, which is a substantially harder problem and worth understanding before you trust it.
Getting this wrong is the source of nearly every sync disaster. A one-way mirror pointed the wrong way replaces the good copy with the old one, immediately, everywhere.
The delete flag
A mirror has to decide what to do about files at the destination that are not in the source. Two answers:
- Leave them. The destination accumulates things the source no longer has. Safe, and gradually less of a mirror.
- Delete them. A true mirror, and a loaded gun. If the source is temporarily wrong — a drive not mounted, a network share that returned an empty listing, a path with a typo — then “the source has no files” is a valid observation and every file at the destination is deleted, correctly, per the rules.
Rules that help:
- Always dry-run first, and read the summary. “Would delete 40,000 files” is a very different plan from “would delete 3”.
- Refuse to proceed if the source looks empty or has shrunk implausibly.
- Make deletion opt-in and separate from apply, so nobody enables it by accident.
Two-way sync and conflicts
Two-way sync needs to answer a question one-way never asks: this file differs on both sides — which change is new?
The only way to know is to remember what both sides looked like last time. With a baseline you can distinguish four cases: changed on A only, changed on B only, changed on both, deleted on one side. Without it, all you have is two files with different contents and two timestamps, and picking the newer one is a guess that silently loses the other person’s work.
So the baseline is not an optimisation. It is the thing that makes conflict detection possible.
When there is a genuine conflict, the right default is to keep both, renamed, and tell you. Every automatic resolution discards somebody’s edit.
Keep the old copy
The single most useful feature in any sync tool is a copy of what was overwritten.
Sync mistakes are usually noticed hours or days later — a file that is now the wrong version, a folder that lost something. If the tool kept the previous contents of every file it overwrote or removed, that is a five-minute fix. If it did not, it is a restore from backup, assuming there is one.
This is also the answer to sync-plus-ransomware, which is otherwise the fastest way to propagate an encryption to every copy you own.
The programs for this
- SyncGuard is the one-way mirror: it prints the whole plan and touches nothing without
--apply, and--deleteis opt-in and only takes effect together with--apply. It writes an audit log of what it did. - MirrorFlow is the two-way one, done properly:
initrecords a baseline,statusreports what changed on each side against it, andsynccan tell your edit apart from the other side’s rather than guessing from timestamps. - FolderSync is the one-way mirror that keeps history. Every file it overwrites or deletes goes into a versions directory first,
versionslists what it has for a given path, andrestoreputs a chosen version back. - SyncLedger does it across the network to another machine over your own HTTP server, with a ledger of what moved.
Free while we are in preview, one file each, Windows and Mac.
Sync is not backup
Worth stating plainly, because a lot of people are relying on it as one.
Sync propagates changes. That includes deletions, corruptions and encryptions, faithfully and quickly, to every copy. A backup is different in exactly one respect: it keeps the state from before. If your only protection is that the same files exist in two places, a mistake exists in two places too.
Details on checking the difference: does your backup actually work.