FileSystemWatcher behaviour

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

    #1

    FileSystemWatcher behaviour

    I would use the filesystemwatch er to trap files changes into a specific
    directory.
    I take a look on the possible message, and 'cause I need to know only
    when a files finishede to have been copy, I user the LastAccess
    message.

    I do a simple project, and there all works fine. So I moved all into
    the main project, a service. I then installed the FTP service on the
    working pc and did a try. Unfortunately running this sample (the
    machine is the same of the previous test) there the message if fired
    just after the file is created.

    I don't know why the behaviour occur. Certainly LastAccess doesn't mean
    last byte written, and file system architecture is quite different from
    what you think I'm thinking, I know. My question is just to know how
    this strange thing happen.

    A part of all. I thinked to solve the problem (know when file has been
    completely write) using a timer. When the file system event fires I add
    an entry into an hashtable or bi-dimensional array, in which I take
    trace of file's name and date-time, then fires the timer every 10
    seconds. If, for example, for 3 times the last-access time stored in
    the array hasn't been changed, I can consider the file written (well or
    not, this certainly could be another problem, but because I'll zip
    file, if it won't be completely written, it'll certainly unreadable).

    What do you think of that?

    Thanks Andrea

  • Armin Zingler

    #2
    Re: FileSystemWatch er behaviour

    "vodafone" <vodafone1@tisc ali.it> schrieb[color=blue]
    > I would use the filesystemwatch er to trap files changes into a
    > specific directory.
    > I take a look on the possible message, and 'cause I need to know
    > only when a files finishede to have been copy, I user the LastAccess
    > message.
    >
    > I do a simple project, and there all works fine. So I moved all into
    > the main project, a service. I then installed the FTP service on the
    > working pc and did a try. Unfortunately running this sample (the
    > machine is the same of the previous test) there the message if fired
    > just after the file is created.
    >
    > [...][/color]


    Have a look @ this group for language unrelated questions:
    microsoft.publi c.dotnet.framew ork


    Armin

    Comment

    Working...