locked
Can I supply an explicit list of files to the FileSyncProvider to sync? RRS feed

  • Question

  • Can I supply an explicit list of files to the FileSyncProvider to sync?

    I have a situation where I have:
    \readme.txt
    \DirA\readme.txt
    \DirB\readme.txt

    I'd like to only sync the 1st and 3rd files.

    Using the FileSyncProvider, I have observed the following:

    Example 1:
    FileSyncScopeFilter filter = new FileSyncScopeFilter();
    filter.FileNameIncludes.Add("readme.txt");   // This will sync all 3 readme.txt files

    Example 2:
    FileSyncScopeFilter filter = new FileSyncScopeFilter();
    filter.AttributeExcludeMask = System.IO.FileAttributes.Directory;
    filter.FileNameIncludes.Add("readme.txt");   // This will sync only the 1st file.

    Example 3:
    FileSyncScopeFilter filter = new FileSyncScopeFilter();
    filter.AttributeExcludeMask = System.IO.FileAttributes.Directory;
    filter.FileNameIncludes.Add("readme.txt");  
    filter.FileNameIncludes.Add("Dir1\readme.txt");   // This throws an exception - the FileSyncProvider doesn't like the path

    Example 4
    FileSyncScopeFilter filter = new FileSyncScopeFilter();
    filter.FileNameIncludes.Add("readme.txt");  
    filter.FileNameIncludes.Add("Dir1\readme.txt");   // This throws an exception - the FileSyncProvider doesn't like the path

    Is there a way to use the FileSyncProvider to only sync a list of files?  Some of which are in sub-directories.

    Thanks


          
               
    • Moved by Max Wang_1983 Wednesday, April 20, 2011 9:48 PM Forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Wednesday, December 2, 2009 4:52 AM

Answers

  • If you want to exclude \DirA\readme.txt then you can do the following:

    FileSyncScopeFilter filter = new FileSyncScopeFilter();

    filter.SubdirectoryExcludes.Add(

    "C:\\DirA\\");

    Of course if you had other files in DirA that you want to still sync, it would be a problem.


    This posting is provided AS IS with no warranties, and confers no rights
    Wednesday, December 2, 2009 8:04 AM