File Watcher


#1

Hi All,

I need to design a workflow for FILE WATCHER.

The purpose is to watch a log.txt file currently being written by another program. The program adds a specific log at the end of every iteration (for eg. SUCCESS).

When I am trying to read the file I am getting an error message that file is currently in use by another program.
What should I need to do so that I can read the file same time it’s being written.


#2

Hi,
You need FileStream Class
Try something like this:

FileStream fileStream = new FileStream( @“c:\words.txt”, FileMode.OpenOrCreate, **
** FileAccess.ReadWrite, FileShare.None);


#4

Driver.xaml (29.9 KB)

I have tried something of my own and ended up like this. Please suggest if I may get any errors using this workflow.

Loop on time is to watch file for changes only for a fixed period of time (here 20 seconds)