FAQ Database Discussion Community


Directory.Exists and FileSystemWatcher

c#,.net,filesystemwatcher
Why does Directory.Exists returns true for a directory observed by FileSystemWatcher even if it was deleted. I must call EnableRaisingEvents = false before checking Directory.Exists since it always returns true. Edit: I am trying to check if folder was deleted or connection lost using error event. To add a delay...

FileSystem watcher onChanged after file Copy

c#,filesystemwatcher
This code is from another stack answer, essentially i'm trying to watch the Users folder in for new files, I understand that OnCreate would fire before the new document has been completely "copied/downloaded", What i'm trying to do is copy it at each onChange event, however the copying doesn't seem...

How to improve this Rx FolderWatcher? [closed]

c#,system.reactive,filesystemwatcher
I started my sample from the one provided here:http://www.jaylee.org/post/2012/08/26/An-update-to-matthieumezil-Rx-and-the-FileSystemWatcher.aspx but the issue is that if you are watching a folder that has many files being modified/created/deleted at all time, it will never return an event since the throttle will never stop. What I needed is to create a new temporary...

How can I make sure this is the last change in FileSystemWatcher onChanged event?

.net,vb.net,filesystemwatcher
I am using FileSystemWatcher to read the contents of a file that is written to by another application. The events that happen are as follows: First, the onCreated event happens. Then, the onChanged event happens, an unknown number of times (sometimes it's 2, sometimes it's 3, and sometimes it's 4)....

Is an infinite loop the best solution to process based on file changes in a directory

multithreading,python-2.7,filesystemwatcher
I am programming a tool which adds files to a processing chain. I want to monitor a specific known directory every 10s, compare, and send the results to my already existing functions. I wrote a short class: class Watchdog(Thread): def __init__(self, path): """ Constructor """ self.watch_folder = path self.verbose =...

FileSystemWatcher locks folder

c#,.net,winforms,filesystemwatcher
Answer below. I can neither delete the question, nor accept my answer (yet). I have a FileSystemWatcher listening on a folder. When I try renaming this folder (in Windows Explorer) I get a The action can't be completed because the folder or a file in it is open in another...

How to start a FileSystemWatcher when the window shell starts

windows,shell,filesystemwatcher
I want to create a shell extension and I need it to respond to events like file created. I know how to use the FileSystemWatcher class but I don't know how to make sure it gets initialized when the shell does. Is there a good way to do this or...

Using a FileSystemWatcher with Windows Service

c#,windows-services,filesystemwatcher
I have a windows service which needs to monitor a directory for files and then move it to another directory. I am using a FileSystemWatcher to implement this. This is my main Service class. public partial class SqlProcessService : ServiceBase { public SqlProcessService() { InitializeComponent(); } protected override void OnStart(string[]...