FileWatcher fires change event after file deletion

Posted by florin on Stack Overflow See other posts from Stack Overflow or by florin
Published on 2010-03-30T09:42:14Z Indexed on 2010/03/30 10:03 UTC
Read the original article Hit count: 427

Filed under:

Hi all,

I'm using a FileWatcher to trigger processing of files as soon as they are added to a folder. After the file it is processed it is deleted.

My problem is that after the file is deleted I get another file change event which is so close to the deletion than in some cases checking for File.Exists it tells that the file still exists. But of course some milliseconds later when looking to process the file it does not really exists. The FileWatcher is set to notify on NotifyFilters.FileName | NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.Attributes

Thanks, florin

© Stack Overflow or respective owner

Related posts about c#