I’m currently building an application that basically syncs files between a master directory and a child directory.
The rules are the following:
- Files in child must be synced to the master and vice versa.
- Files deleted in child must NOT be deleted in the master.
- Files that were deleted in child that are existing in master will be synced back to the child.
- Files deleted in master will be deleted in the child.
So far, using examples from google and msdn I was able to deal with 1 and 2 but now i’m currently stuck in 3 and 4.
I’m using Microsoft’s sync framework and would like to know how to make rule 3 and 4 work using also sync framework.
The problem with rule 3 is that when a file is deleted in child, when the sync gets triggered, it does not recreate that file.
For rule 4, I’m not sure how to do this yet. Any idea would be great.
Please help. Thank you
EDIT: made rule 3 work by deleting filesync.metadata file after every sync in the child directory. Not sure though if this will cause problems later.
deleting the filesync.metadata will erase all information over what was synched before. you are effectively reinitializing it. I suggest you intercept the changes in the ApplyingChange event, skip the change you dont want and do the custom actions that you need to do.