Howto Handle Conflicts

Get help for specific problems
Posts: 2
Joined: 13 Jan 2006

maiuz

Hello

Meanwhile, I thank you for the wonderful program that makes available to us!
I created a script that automates the synchronization according to the
availability of a resource on the network (in practice with a simple ping
estimate).

My problem is that I want to automatically manage the conflicts that are
created when both sides are updated since the last synchronization. For
example, according to the newest of the two sides, which is what interests me.

Is there a way to enable this feature?

Thanks MaiuZ

P.S. Excuse my English, I hope not writing stupid things
User avatar
Site Admin
Posts: 7163
Joined: 9 Dec 2007

Zenju

> automatically manage the conflicts
I assume you are talking about a sync in <automatic> mode. This mode models a
synchronization for two data sources having the "same relevancy". Therefore
it's contradictory to "automatically resolve conflicts": This effectively
would express that you give one data source a higher priority than the other
by forcing a single direction. But in this case you may be better off with a
mirror sync from the higher to the lower priority data source anyway.

Having said that, the simplest thing to resolve conflicts would probably to
fire a mirror sync directly after the <automatic> mode sync. Make sure to
ignore errors for the <automatic> sync to skip the warning "conflicts
existing", and execute the mirror only if the first sync failed ( = returns
with errorlevel < 0).

Regards, Zenju
Posts: 2
Joined: 13 Jan 2006

maiuz

First of all thanks for replying so fast!

Sorry if I have not explained well, obviously I meant the automatic mode as
you understood.
I understand that this is something a bit dangerous to do (because we normally
do not know if the newest is actually the one to keep). But I would not give
higher priority to one side, I wish that if a file one side is newer than the
other side, replace it.

I try to explain better:




IF EXIST "conflict" then goto RESOLVECONFLICT else goto EXIT

: RESOLVECONFLICT
IF "file A side" is the newest "file B side" overwrite "file B side" with "file A side"
ELSE
overwrite "file A side" with "file B side"

:EXIT



I hope I have been clear.
User avatar
Site Admin
Posts: 7163
Joined: 9 Dec 2007

Zenju

> I wish that if a file one side is newer than the other side, replace it.

No problem, here is an (adapted) batch sample taken from the helpfile:




"C:\Program Files\FreeFileSync\FreeFileSync.exe" "C:\SyncAutomatic.ffs_batch"
@if not errorlevel 0 (
::resolve conflicts
@echo Resolving conflicts...
"C:\Program Files\FreeFileSync\FreeFileSync.exe" "C:\SyncTwoWay.ffs_batch"
pause
)



Setup "SyncTwoWay.ffs_batch" with custom sync-directions to have new files
overwrite old files on both sides.
Posts: 7
Joined: 6 Sep 2012

ucaakashi

This was helpful! Since this thread is from 2010, I was curious to know if
there is a different/better way to accomplish this now such that an automatic
sync uses the newer file as "authoritative" during a conflict resolution.

Thanks!
User avatar
Site Admin
Posts: 7163
Joined: 9 Dec 2007

Zenju

There still isn't a non-manual conflict resolution for automatic variant, so
the approach above stays valid. But the error codes have changed and are now
*positive* => "if errorlevel 1" instead of "@if not errorlevel 0" must be
used; see current FFS helpfile.
Posts: 2
Joined: 23 Jul 2015

mathiaslin

I am looking into the same question right now. Unfortunately, I don´t see how a TwoWay-sync would help here. If both files have updated timestamps than stored in the sync db, then the conflict would still be ignored, regardless what you have set in the two way sync option (compare by file content or compare by date and size).
Comparing by date and size only works if one file has been modified, but not both. If both files have meanwhile be modified, it would still be ignored by the two-way sync.

Can you explain how you manage to configure the custom sync directions based on the *newest* file:

> "Setup "SyncTwoWay.ffs_batch" with custom sync-directions to have new files
overwrite old files on both sides."

Thanks!
Posts: 3
Joined: 9 Nov 2017

rob

Hi, using v9.5 I managed conflict handling this way (requires 3 steps):

1. run 2way-default: conflicts=skip > syncs all non conflicting files
2. run 2way-custom: conflicts=leftwards & deletions=timestamp-versioning into left org folder(!) > forces sync and thereby renames conflicting files instead of overwriting them in left side
3. run 2way-default again > replicates newly generated files (=conflict docs) to right side

Only tradeoff is, Priority is not "newer" but always one side, but that's ok as long as conflict docs are kept as versions in the original place. Actually, it's even better to have 2 versions instead of only the newer one, 'cause sometimes just the elder one is the better.

Used this method with an automated task using a script like that:
FreeFileSync.exe "C:\jobs\sync\BatchRun_A.ffs_batch"
if errorlevel 1 (
  FreeFileSync.exe "C:\jobs\sync\BatchRun_B.ffs_batch"
  FreeFileSync.exe "C:\jobs\sync\BatchRun_A.ffs_batch"
)
Posts: 1
Joined: 1 Dec 2021

McGyver

Hi, I bumped into the same problem, solved it this way on v10:
- Show only the conflict files (or run a sync ignoring confilicts and re-run a sync).
- Click on the first conflict symbol in the list and choose what to do (copy to left, copy to right, or do nothing).
- While keeping the mouse pressed, scroll down to select all files in conflict: your choice will be applied to all files.
Click the Sync button.
Posts: 2
Joined: 23 Jul 2024

mibit

Thanks @McGyver, that worked well, though I simply selected all on the destination and made the selection.