Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# file watcher

public MainWindow()
{
    InitializeComponent();

    FileSystemWatcher fsw = new FileSystemWatcher();
    fsw.Filter = "test1.csv";
    fsw.NotifyFilter = NotifyFilters.LastWrite;
    fsw.Path = "z:	emp";
    fsw.Changed += Fsw_Changed;
    fsw.EnableRaisingEvents = true;    
}

private void Fsw_Changed(object sender, FileSystemEventArgs e)
{
    MessageBox.Show(e.FullPath);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #file #watcher
ADD COMMENT
Topic
Name
9+6 =