locked
Set ScopeFilter with Modified Date? RRS feed

  • Question

  •  

    I'm looking to synchronize files between 2 directories that have been added/changed/modified in the last 30 days.

     

    Is there anyway to filter the files that are sync'd by last modified date? The FileSyncProvider.ScopeFilter object has a property AttributeExcludeMask but it does not contain a modified date attribute.

     

    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:04 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Thursday, June 12, 2008 6:58 PM

Answers

  • Current implementation of scope filter does not filter on time-data of the file/folders.

     

    However, you could achieve time-based filtering by using the information in *FileData arguments (likely CurrentFileData) within the argument ApplyingChangeEventArgs returned by raised ApplyingChange event. To catch this event, you would need to resgister an event handler.

     

    This link should be of further help : http://msdn.microsoft.com/en-us/library/bb902846(SQL.100).aspx

     

    Hope this helps, let us know how it went.

    Sameer

    Wednesday, June 18, 2008 11:08 PM
  • Nice! As for deleting the stale files on destination - look at it this way - it's not a "sync operation" - it's more like a local operation on the target endpoint. So File Sync Provider (FSP) shouldn't be deleting files unless a file/folder delete is being synced over from the source.

     

    One way to achieve this - you could write a method which walks down the sync-scope hierarchy and cleans up stale files. You could invoke this on the target endpoint - as you would know the target provider when you start the sync. You could do this before or after the sync.

    But there would be a side-effect. Next time when you sync "from" the endpoint on which stale-file clean up was performed, those file/folder deletes would be synced over to the target of that sync as well. That may come unexpected to you.

     

    Hope this helps.

     

    Sameer

     

    Wednesday, June 25, 2008 6:07 PM

All replies

  • Current implementation of scope filter does not filter on time-data of the file/folders.

     

    However, you could achieve time-based filtering by using the information in *FileData arguments (likely CurrentFileData) within the argument ApplyingChangeEventArgs returned by raised ApplyingChange event. To catch this event, you would need to resgister an event handler.

     

    This link should be of further help : http://msdn.microsoft.com/en-us/library/bb902846(SQL.100).aspx

     

    Hope this helps, let us know how it went.

    Sameer

    Wednesday, June 18, 2008 11:08 PM
  • Yes!  This did allow me to filter the files that were copied over by the last modified date. 

     

    However, I only want to keep just x number of days of files in the target directory.  Once a file is copied to the target is there a way to configure the sync to remove items older than a certain date?

     

    I"m using the file sync provider with the sync direction option of "Upload".

    Friday, June 20, 2008 2:31 PM
  • Nice! As for deleting the stale files on destination - look at it this way - it's not a "sync operation" - it's more like a local operation on the target endpoint. So File Sync Provider (FSP) shouldn't be deleting files unless a file/folder delete is being synced over from the source.

     

    One way to achieve this - you could write a method which walks down the sync-scope hierarchy and cleans up stale files. You could invoke this on the target endpoint - as you would know the target provider when you start the sync. You could do this before or after the sync.

    But there would be a side-effect. Next time when you sync "from" the endpoint on which stale-file clean up was performed, those file/folder deletes would be synced over to the target of that sync as well. That may come unexpected to you.

     

    Hope this helps.

     

    Sameer

     

    Wednesday, June 25, 2008 6:07 PM
  • I ended up doing just that: I created a separate process to clean up old files on the target.  This is a one-way sync only from the source so I don't have to worry about the deletes on target getting propogated back to the source.

     

    Thanks for your help!

    Thursday, June 26, 2008 1:43 PM