I'm having trouble understanding how FileSystemWatcher is supposed to work. I'm trying to get my code to wait for a file to exist, and then call on another function. My code is as follows:
string path2 = @"N:\reuther\TimeCheck\cavmsbayss.log";
FileSystemWatcher fw = new FileSystemWatcher(path2);
fw.Created += fileSystemWatcher_Created;
Then I have a seperate function that should handle the file once its event is called:
static void fileSystemWatcher_Created(object sender, FileSystemEventArgs e)
{
MessageBox.Show("Ok im here now");
}
But it
The directory name N:\reuther\TimeCheck\cavmsbayss.log is invalid.