locked
Locked Files in a NTFS sync program RRS feed

  • Question

  •  

    Hi,

     

    I am doing a NTFS sync program and I read that it skip the locked files (tipically case: a file it's in use and saved but not closed)... Itry but It not skip this files and the sync stop immediatly..

     

    The typical error is: Can't acces at file xxx because is used by another program .... (this idea is this not the exact text)

     

    I read and search a solution but many article and sample are for the Microsoft sync framework CTP 1.0...

     

    I try to search in the CTP 2.0 a similar command, similar code, ... but it's not correspond...

     

     

    Someone have a idea about a possible resolution to rsolve this conflict?

     

     

    Thanks in advanced

     

     

    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:10 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Thursday, April 17, 2008 2:29 PM

Answers

  • I found....

     

    I insert in my file.cs where there is a method that it synchronize the folder

     

    public void Synchronize(KnowledgeSyncProvider destinationProvider, KnowledgeSyncProvider sourceProvider, uint batchSize, string scopeName)

    {

    // Configura la grandezza del batch in ogni provider

    ((MyStore)destinationProvider).RequestedBatchSize = batchSize;

    ((MyStore)sourceProvider).RequestedBatchSize = batchSize;

    //Decido chi va a vincere nei conflitti

    destinationProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined;

    sourceProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined;

    // Creo la sessione di sync

    SyncOrchestrator syncAgent = new SyncOrchestrator();

    syncAgent.LocalProvider = destinationProvider;

    syncAgent.RemoteProvider = sourceProvider;

    //scelgo la direzione di sync

    syncAgent.Direction = SyncDirectionOrder.DownloadAndUpload;

    //sincronizza

    try

    {

    SyncOperationStatistics s = syncAgent.Synchronize();//here it skip a locked file

    }

    catch (Exception ex)

    {

    }

    }

     

    This problem is resolt... but I have another problem with metadatafile:

     

    If the program see that it's a locked file it skip this, but it save in metadata file the status of the file.. If i do restart the program in a second time (or a third, ... ) if the file is so closed, it don't see that is so closed and skip this file ...

     

    Now I'm search how I can unblock this file in the metadata file.$

     

     

    Ilan

     

     

     

     

     

    Saturday, April 19, 2008 5:27 PM