Questions tagged [filesystemwatcher]

FileSystemWatcher is a .NET component class that listens to the file system change notifications and raises events when a directory, or file in a directory, changes.

The System.IO.FileSystemWatcher component class can be used in .NET applications to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. These changes can be observed on a local computer, a network drive, or a remote computer.

The Filter property can be set with a string value indicating which files and/or directories are to be watched for changes.

1220 questions
15
votes
3 answers

Is it really that expensive to increase FileSystemWatcher.InternalBufferSize?

I'm using a FileSystemWatcher to monitor changes in a folder, but as soon as I have more than a few hundred modifications in a short time, I miss some of them because the internal buffer overflows. So I want to increase the InternalBufferSize (I…
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
14
votes
4 answers

Transfer large data between .net applications on same computer

I have two .net applications that run on the same machine. The first application is the 'Engine'. It builds images - image's size is about 4M. The second applications is the 'Viewer'. It shows the images which the 'Engine' sends. The engine sends…
MTs
  • 514
  • 5
  • 13
14
votes
7 answers

FileSystemWatcher for FTP

How can I implement a FileSystemWatcher for an FTP location (in C#). The idea is whenever anything gets added in the FTP location I wish to copy it to my local machine. Any ideas will be helpful. This is a follow up of my previous question Selective…
softwarematter
  • 28,015
  • 64
  • 169
  • 263
14
votes
8 answers

FileSystemWatcher - is File ready to use

When a file is being copied to the file watcher folder, how can I identify whether the file is completely copied and ready to use? Because I am getting multiple events during file copy. (The file is copied via another program using File.Copy.)
snober
  • 229
  • 1
  • 3
  • 10
13
votes
5 answers

FileSystemWatcher and windows 7

I am writing a tool that monitors a network directory and is running off of a Windows Server 2008 machine, the OnChanged event for the FileSystemWatcher is being fired correctly from files placed on the network drive by any computer that is not…
Jesus Ramos
  • 22,940
  • 10
  • 58
  • 88
13
votes
5 answers

Does anyone have a FileSystemWatcher-like class in C++/WinAPI?

I need a .Net's FileSystemWatcher analog in raw C++/WinAPI. I almost started to code one myself using FindFirstChangeNotification/FindNextChangeNotification, but then it occurred to me that I am probably not the first one who needs this and maybe…
Alex Jenter
  • 4,324
  • 4
  • 36
  • 61
12
votes
3 answers

FileSystemWatcher Network Disconnect

I have a FileSystemWatcher monitoring a file on a network share. If an event occurs to make the share unavailable, maybe due to a network problem, the FileSystemWatcher becomes disconnected. Obviously I can handle the "Error" event, maybe do some…
Kevin Higgins
  • 131
  • 1
  • 6
11
votes
4 answers

FileSystemWatcher causes crash to desktop

I'm writing a solution where I use some configuration files that should be editable at runtime. I've been using FileSystemWatcher for this purpose before and never had much issues with it but now it's causing a CTD on the 'rename' event. This…
Jonas Rembratt
  • 1,550
  • 3
  • 17
  • 39
11
votes
3 answers

FileSystemWatcher Dispose call hangs

We just started running in to an odd problem with a FileSystemWatcher where the call to Dispose() appears to be hanging. This is code that has been working without any problems for a while but we just upgraded to .NET3.5 SP1 so I'm trying to find…
Scott Dorman
  • 42,236
  • 12
  • 79
  • 110
11
votes
4 answers

How to force FileSystemWatcher to wait till the file downloaded?

I am downloading a file and want to execute the install only after the download is complete. How do I accomplish this? Seems like FileSystemWatcher onCreate event would do this but this happens in a different thread, is there a simple way to force…
satyajit
  • 1,470
  • 3
  • 22
  • 43
11
votes
15 answers

VB.NET FileSystemWatcher Multiple Change Events

I have the following code: Imports System.IO Public Class Blah Public Sub New() InitializeComponent() Dim watcher As New FileSystemWatcher("C:\") watcher.EnableRaisingEvents = True AddHandler watcher.Changed,…
John Kurlak
  • 6,594
  • 7
  • 43
  • 59
11
votes
3 answers

BackgroundWorker & Timer, reading only new lines of a log file?

My application writes a log file (currently using log4net). I'd like to setup a timer and a background worker to read the log file and print its content into some control in my form, while it's being written. I can't use the FileSystemWatcher class…
gremo
  • 47,186
  • 75
  • 257
  • 421
11
votes
3 answers

Unit-testing FileSystemWatcher: How to programatically fire a changed event?

I have a FileSystemWatcher watching a directory for changes, and when there's a new XML file in it, it parses that file and does something with it. I have a few sample XML files in my project that I am using for unit-testing purposes for the parser…
Near
  • 391
  • 4
  • 16
11
votes
2 answers

Reading file content changes in .NET

In Linux, a lot of IPC is done by appending to a file in 1 process and reading the new content from another process. I want to do the above in Windows/.NET (Too messy to use normal IPC such as pipes). I'm appending to a file from a Python process,…
jameszhao00
  • 7,213
  • 15
  • 62
  • 112
10
votes
1 answer

Do I need to keep a reference to a FileSystemWatcher?

I'm using a FileSystemWatcher (in an ASP.NET web app) to monitor a file for changes. The watcher is set up in the constructor of a Singleton class, e.g: private SingletonConstructor() { var fileToWatch = "{absolute path to file}"; var fsw =…
M4N
  • 94,805
  • 45
  • 217
  • 260
1 2
3
81 82