Results 1 to 3 of 3

Thread: [resolved]FileSystemWatcher problem?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Posts
    362

    [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.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Posts
    362

    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
  •  



Click Here to Expand Forum to Full Width