Re: Synchronize 2 folders
Posted: 02 Sep 2017 05:26
Thank you for taking the time to review what I wrote. Much appreciated.
Well, that's why I said back on February 25 that keeping track of state is really essential to a true sync.
Here's why:
If you brute-force "Two-Way Sync (Union)", then files that were meant to be deleted get repopulated accidentally. No good.
If you brute-force "Two-Way Sync (Intersection)", then unique files on both sides that are meant to be there will get deleted accidentally. No good.
For example, Dino took a bunch of new photos in the Field that Gertrude obviously does not have yet in the Office. (These folks didn't think to use Dropbox, of course.) With your proposed Intersection, all of Dino's new photos would get blasted into oblivion upon sync. That's obviously not too useful, either.
Here's my analysis:
1. For the average, extremely quick sync, one-way sync will probably work fine for most people.
2. For two-way sync, you really have to propagate deletions to make it useful. And to usefully propagate deletions (and additions), you really have to know which files were there before, which files were added intentionally, and which files were deleted intentionally. You can't figure that out by just looking at the files. You have to know what happened to the files over time.
How else would you know:
- That a file was deleted from one side and should be deleted on the other side, vs. being reintroduced;
- That a file was added on one side and should be added on the other side, vs. being deleted.
When comparing files for overwrite, you can always look at the timestamp to figure out the newer file. But there is no timestamp on a deleted (aka nonexistent) file. Thus tracking state is really the only way to do useful 2-way sync.
Well, that's why I said back on February 25 that keeping track of state is really essential to a true sync.
Here's why:
If you brute-force "Two-Way Sync (Union)", then files that were meant to be deleted get repopulated accidentally. No good.
If you brute-force "Two-Way Sync (Intersection)", then unique files on both sides that are meant to be there will get deleted accidentally. No good.
For example, Dino took a bunch of new photos in the Field that Gertrude obviously does not have yet in the Office. (These folks didn't think to use Dropbox, of course.) With your proposed Intersection, all of Dino's new photos would get blasted into oblivion upon sync. That's obviously not too useful, either.
Here's my analysis:
1. For the average, extremely quick sync, one-way sync will probably work fine for most people.
2. For two-way sync, you really have to propagate deletions to make it useful. And to usefully propagate deletions (and additions), you really have to know which files were there before, which files were added intentionally, and which files were deleted intentionally. You can't figure that out by just looking at the files. You have to know what happened to the files over time.
How else would you know:
- That a file was deleted from one side and should be deleted on the other side, vs. being reintroduced;
- That a file was added on one side and should be added on the other side, vs. being deleted.
When comparing files for overwrite, you can always look at the timestamp to figure out the newer file. But there is no timestamp on a deleted (aka nonexistent) file. Thus tracking state is really the only way to do useful 2-way sync.