30 ตุลาคม 2552 17:25I have the following scenario that the FileSyncProvider does not seen to handle. I have a network folder and a local folder that I want to sync. I want the local folder to exactly mirror the network folder. Any changes I make to the network folder are correctly replicated to the local folder. Any changes I make to the local folder are not undone by synchronization. As an example, I want a file that is deleted from the local folder to be replaced by the copy of the file that was not deleted in the network folder. How do I perform this type of synchronization using the Sync Framework. As a further note, the SyncToy exhibits the same behavior in Echo mode.
30 ตุลาคม 2552 18:20Hi, DotNetCADD.
There is no "direct" way of accomplishing your scenario. Here's why:
Synchronize means that destination will "learn" changes from source. (note that nothing is told about changes made on destination). In your case the server is the source, and the local folder is the destination.
Say you have file X.txt, which is sync-ed between Source (server) and Destination (local).
Now on destination you delete it, and there are no changes to this file on the source. When you sync, there will be NO change detected for X.txt on the source, so it will be simply skipped.
You could perform a "trick" by making dummy update to X.txt on the source and set the policy to "Source Wins". You will have an update-delete conflict, which will be resolved with "Source Wins", hence the file will be copied over again from the server.
THis approach is bad because if you don't know which file have been deleted on destination you will have to update all files on source, which will mean that updates to all files will be sync-ed over, and will decrease performance drastically.
Hope this helps.
17 พฤศจิกายน 2552 13:20
I see a use for this request. I have posted a related feature request on the Synctoy forum so apologies for slight spamming.
In addition to the original poster's scenario, how about the case where the target folder is used as a backup. Should the source folder be lost, the backup folder needs to contain exactly what was in the source, no more, no less. This is surely a common case.
In this scenario, when the sync is performed, the desired logic in addition to that effected by the Echo action (in synctoy terminology) would be:
1. check for anything added to the target that didn't match something in the source (using the chosen matching rules), and remove it from the target.
2. If anything has been deleted from the target that is still present in the source, it should be reinstated in the target.
Is this doable in the sync framework, and in synctoy? I have no idea of the inner workings, but assume that a file manifest is maintained, and that the metadata necessary for a two-way sync would also be sufficient to perform this one way 'Refresh' action.
24 พฤศจิกายน 2552 1:14ผู้ดูแลHi Ziggyzack,
Let me clarify, what you want is to always use the content on one endpoint (you call it "Source") to replace the content on the other endpoint (you call it "Target") no matter what user does on the target, as the following, right?
[Source] ------------------------> [Target as backup]
In this case, in order to keep the Target content exact same as the Source content, you will need to use Echo plus the "trick" Adrian mentioned above to handle both "delete" and "change" that only happen on the target so that sync can leverage the "Source Wins" policy to overwrite the change/delete actions on the Target. The reason Adrian has explained. You might be able to solve the performance issue by detecting which files were changed/deleted only on the target and then making the dummy changes to the corresponding files on the Source (instead of update all files on Source). Therefore, it is doable, but since this is not a standard way to use sync framework, it does requires addtional work on top of sync framework to make it happen. Besides, SyncToy currently doesn't support this scenario, but we might consider it for next release.
Thanks for the feedback and hope this answers your questions.
- ทำเครื่องหมายเป็นคำตอบโดย Liam Cavanagh - MSFTMicrosoft, Owner 24 พฤศจิกายน 2552 17:31