FileSystemWatcher OnChanged

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D2

    #1

    FileSystemWatcher OnChanged

    Hi,

    I'm using FileSystemWatch er to monitor certain folders in file system.
    In some specific scenarios where a large file is copied to the
    monitored folder, I receive too many Onchanged events. I'm clueless as
    how can i detect the file has finally been copied? any help would be
    appreciated.

    thanks,
    d2
  • =?Utf-8?B?UGV0ZXIgUml0Y2hpZSBbQyMgTVZQXQ==?=

    #2
    RE: FileSystemWatch er OnChanged

    You can't know for sure. You can't even know if the two OnChanged events
    were the result of the same action or the same application.

    The best you can do is timeout after a certain amount of time without
    receiving OnChanged. e.g. when you get an OnChanged for a file, set a timer
    for 500 ms. If you get another OnChanged event, reset that timer. When the
    Elapsed event for the timer is raised, you know nothing has changed the file
    in 500ms and whatever action that was being performed might be completed.

    --
    Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.

    Microsoft MVP, Visual Developer - Visual C#


    "D2" wrote:
    Hi,
    >
    I'm using FileSystemWatch er to monitor certain folders in file system.
    In some specific scenarios where a large file is copied to the
    monitored folder, I receive too many Onchanged events. I'm clueless as
    how can i detect the file has finally been copied? any help would be
    appreciated.
    >
    thanks,
    d2
    >

    Comment

    Working...