none
Sync failing in multiple folder RRS feed

  • Question

  • Hi,

           I used same application by my own to do File sync and am facing one problem while doing syncing files, Could any one reply me any answer?

    Problem: File Sync callback returning Delete file instead of Copy : i created 3 folders in my local machine, (i.e test, test1, test2) I copied one file in test1 folder and started test and test1 sync, this time new file copied to test folder which is expected and then done sync "test and test2"  then this time instead of coping file to test2 folder it's deleting file from test folder, I expected new file is created in test folder then it should copy to test2 folder.

    am using sample application given in MSDN.

    • Moved by Deepa ChoundappanEditor Thursday, August 5, 2010 8:59 PM This is a developer question (From:SyncFx - SyncToy-File Synchronization)
    Monday, August 2, 2010 2:35 AM

All replies

  • Hi -

    It looks like you might not be pointing your sync's to the correct metadata store files. When initialiazing the file sync provider with a metadata store file , be sure to initialize it with the corresponding correct file. Also, be sure that everytime you reset you test scenario you need to delete this metadata store file.

    Thanks
    Deepa


    Deepa ( Microsoft Sync Framework)
    Thursday, August 5, 2010 9:31 PM
    Answerer
  • Hi Deepa,

                    Thank you for your reply, In my test program the metadata file is generated in bin\Release folder , I deleted metadata file and i done same steps ( First do sync test  -- test1 and this time the new file copied from test1 to test dir and then do test on test- test2 this time there is no action it's saying the both files ae upto date). Can you please tell me is this correct way of doing?

     

    The code snippet below 

    ==================================================================================

     public void InitializeSyncProvider(string szLocalReplicaPath, string szPartnerReplicaPath, ref string szErrorCause, ref int dwErrorCode)

            {

                eOptions = FileSyncOptions.ExplicitDetectChanges | FileSyncOptions.RecycleDeletedFiles |

                             FileSyncOptions.RecyclePreviousFileOnUpdates | FileSyncOptions.RecycleConflictLoserFiles;

     

                objFilter = new FileSyncScopeFilter();

                objFilter.FileNameExcludes.Add("*.lnk");

     

                szLocalMetadataPath = Directory.GetCurrentDirectory() + "\\Metadata";

                if (!Directory.Exists(szLocalMetadataPath))

                    Directory.CreateDirectory(szLocalMetadataPath);

     

                szPartnerMetadataPath = szLocalMetadataPath; // Server Metadata dir path

     

                szLocalMetadataFileName = "Local.Metadata"; // Local Metadata File Name

                szPartnerMetadataFileName = "Partner.Metadata"; // Server Metadata File Name

                szTempDir = szLocalMetadataPath;

     

                DetectChangesOnReplica(szLocalReplicaPath, objFilter, eOptions, szLocalMetadataPath,

                                        szLocalMetadataFileName, szTempDir, ref szErrorCause, ref dwErrorCode);

                DetectChangesOnReplica(szPartnerReplicaPath, objFilter, eOptions, szPartnerMetadataPath,

                                        szPartnerMetadataFileName, szTempDir, ref szErrorCause, ref dwErrorCode);

            }

    ===========================================================

    Friday, August 6, 2010 3:15 AM
  • It looks like your problem is creating of the metadata file in the release/bin directory. Because the same file is being reused for both of the sync's that you are doing. Create seperate ( uniquely named files) for each folder pair that you are creating and sync'ing. This means that test directory should have two metadata files - one when it is sync'ing with test1 and a different one when sync'ing with test2.

     

    Thanks
    Deepa


    Deepa ( Microsoft Sync Framework)
    Tuesday, August 10, 2010 5:23 PM
    Answerer
  • Hi Deepa, 

                   Thank you for your reply, yes i tried this solution and so far it's working fine!! Thank you very much, Can you please suggest me any good example of using metadata file if you dont mind!

     

    Thanks,

     Srinivas!

    Thursday, August 12, 2010 1:50 AM
  • Hi -

    The best example on how to use the file is the file sync provider. It does look like you have already seen this sample.

    http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3424

    Thanks
    Deepa


    Deepa ( Microsoft Sync Framework)
    Friday, August 13, 2010 5:38 PM
    Answerer