Microsoft Sync Framework mirror sync for file system

梦想与她 提交于 2020-01-06 02:42:08

问题


I am looking to use Microsoft Sync Framework to sync file system directories. I am interested in a "mirror sync" which ensures that the target directory looks exactly like the source directory. That means that if a file is deleted on the source, it will be deleted on the target as well. Similarly, if for some reason target file is newer, source file should still overwrite it. Basically after the sync is done, target will look exactly like the source no matter what. I noticed that the SyncOrchestrator has a Direction property which I've set to SyncDirectionOrder.Upload but the above two scenarios are still not handled the way I'd like (i.e. newer file is preserved, and target file is not deleted). Is there is anything I can do to make the sync work the way I want? Handle some event or override a certain behaviour?


回答1:


Sync Fx does incremental syncs, meaning, it will only try sync files that has change in source. If it hasn't change, its not detected.

If you simply want the folders to be identical, why not simply do plain copy overwriting the destination rather than using Sync Fx?

if you really want to do it, delete the sync metadata file and sync fx has no idea what has been synched, therefore it's going to apply the files from the source to the destination.



来源:https://stackoverflow.com/questions/28280858/microsoft-sync-framework-mirror-sync-for-file-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!