-
Sep 4th, 2011, 10:04 AM
#1
Thread Starter
Hyperactive Member
[resolved]FileSystemWatcher problem?
I'm using FileSystemWatcher in an application. it monitors the files in a folder, then do some processing. I monitor FileCreate, Change, Rename, Delete event.
the problem is: when I copy some images to that folder, it fired the create event, but the file is not actually ready, so, when I load the file in the event handler, it failed.
how can deal with this correctly?
thanks
bear
Last edited by FlyingBear; Sep 4th, 2011 at 01:24 PM.
-
Sep 4th, 2011, 10:24 AM
#2
Re: FileSystemWatcher problem?
Capture the file name, add it to an array, Thread.Sleep a bit, process it. You could keep it in the array for a while longer if it still fails. You may also want to look at processing those files in separate threads which are invoked from a timer.
-
Sep 4th, 2011, 01:25 PM
#3
Thread Starter
Hyperactive Member
Re: [resolved]FileSystemWatcher problem?
thanks for reply.
the problem is because the file size is big, when "created" triggered, the file is not actually ready yet.
refer to http://bloggingabout.net/blogs/jschr.../06/12886.aspx
need make sure the file is ready, then can process more.
thanks again.
bear
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|