Stale file left in the target directory of a synchronization run RRS feed

  • Question

  • Good Morning World!  I am just getting started with file synchronization using Microsoft.Synchronization.Files.  Hopefully this will be an easy question for you more experienced synchronizers!

    I'm essentially using the SyncFileSystemReplicasOneWay example from Microsoft's site.  The method sets up a sourceProfider, a tartgetProvider, implements events for AppliedChange and SkippedChange, creates a SyncOrchestrator and assigns it's Local and Remote providers, the direction (upload), and then runs the sync.  This has some real potential for me in development for staging test servers.  I have a build server and I intend to take particular builds and blast them out to a bunch of staging servers for testing, but the staging servers need to "pull" the code down in a sequence that involves stopping application pools, running a bunch of other checks, and then running the synchronization.

    First tests are looking fantastic and I'm really excited, but there are files left behind.  I'm hoping to figure out a way to have the synchronization process eliminate outdated files, or files that don't exist in the source directory, without having to manually remove them.

    I checked the FileSyncOptions enumeration and that doesn't seem to have much for this scenario.  I'm really hoping Microsoft thought of this when implementing this class, and that I'm just not finding it yet.

    So to boil it down, I run a sync and files from source directory get copied to the target directory.  The next time a sync occurs, if a file has been removed from the source directory, the previously synchronized file is left in the target directory.  RSync, for example, has options to remove these files.  Does this framework have a similar option?


    Tuesday, August 7, 2012 1:26 PM

All replies

  • if a file is removed/deleted from the source, sync framework by default would apply the delete on the destination as well.

    doesnt SkippedChange report anything?

    note that Sync Framework is based on incremental changes, not differential. what has changed since the last sync vs what is in the source that is not in the destination.

    speaking of synching staging servers, have you looked at Web Farm Framework? http://www.iis.net/download/WebFarmFramework

    Tuesday, August 7, 2012 2:30 PM
  • Thanks for the response. The SkippedChange event does not report anything for this file.  I can confirm that it doesn't get removed, and that the metadata files exist in both locations.

    Thanks for the web farm tip.  I'll look at that for coordinating code staging.  I assume it's able to be incremental since it has these cheater files, and that they're used to increase performance.  I wish I could read the file.  Since the file exists and I'm not seeing the delete action on my end, what are my options?



    Tuesday, August 7, 2012 4:50 PM