filesystemwatcher

What are practical limits on the number of FileSystemWatcher instances a server can handle?

半城伤御伤魂 提交于 2019-11-27 11:35:52
问题 I have a windows service that is currently instantiating about a dozen FileSystemWatcher instances to monitor shared folders across the corporate network for files to be processed. I am looking into adding more instances so I'm wondering if anyone here has experience (with production systems) as to what are practical limits on number of FileSystemWatcher instances a production system can reliably handle? Edit: In my case, the InternalBufferSize property is not modified so the

FileSystemWatcher used to watch for folder/file open

牧云@^-^@ 提交于 2019-11-27 09:08:29
I have browsed around but cannot find any information on what I am seeking, if there is another post that already goes over this then I apologize. I am seeking help with code that will monitor a specific folder for when the folder is opened by another person or when a file under said folder is opened. At this point I can see when a user opens and modifies any files but if they just open the file to view it, it does not throw an event even when I add LastAccessed. Any information or help would be appreciated. Folder name is C:\Junk Code in C# 4.0: [PermissionSet(SecurityAction.Demand, Name =

FileSystemWatcher to watch UNC path

房东的猫 提交于 2019-11-27 07:27:29
There are no shortage of questions on this topic, but I'm still having trouble. Here is my situation. I've got a service that I need to watch a path that is specified in the config file. It works great when I used a local drive. However, when I change it to something like \\server2\secondary\temp\watch_folder the service does not start. The error in the log is The directory name \\server2\secondary\temp\watch_folder is invalid. If I copy that directly into Windows Explorer the folder opens fine. If I take my code and paste it into an old Winforms app it works fine. I've tried all of the "Log

Watching for file and directory changes in Java

不羁岁月 提交于 2019-11-27 07:16:51
问题 I'm writing here mostly for advice on where to start. I've already implemented a class that will recursively watch a directory using Java's WatchService. It works quite alright for detecting changes, but I've noticed a fatal flaw: I cannot delete directories that are being watched that contain directories that are being watched. This seems to be a limitation of WatchService. I have also looked into Apache's VFS FileListener a bit, but before I spend another 6-or-so hours of my time building

How do I know when a file has been modified in a VBA Macro?

我们两清 提交于 2019-11-27 07:11:52
问题 Is there a way to watch a file in VBA (which is essentially VB6), so that I know when the file has been modified? -- similar to this only I don't want to know when a file is unused , just when its modified . The answers I've found have recommended using "FileSystemWatcher" and the Win32 API "FindFirstChangeNotification". I can't figure out how to use these though, any idea? 回答1: Okay, I put together a solution that is able to detect file system changes, in VBA (VB6). Public objWMIService,

Detecting moved files using FileSystemWatcher

早过忘川 提交于 2019-11-27 04:24:11
I realise that FileSystemWatcher does not provide a Move event, instead it will generate a separate Delete and Create events for the same file. (The FilesystemWatcher is watching both the source and destination folders). However how do we differentiate between a true file move and some random creation of a file that happens to have the same name as a file that was recently deleted? Some sort of property of the FileSystemEventArgs class such as "AssociatedDeleteFile" that is assigned the deleted file path if it is the result of a move, or NULL otherwise, would be great. But of course this doesn

VB.NET FileSystemWatcher Multiple Change Events

人走茶凉 提交于 2019-11-27 02:47:13
问题 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, AddressOf watcher_Changed End Sub Private Sub watcher_Changed(ByVal sender As Object, ByVal e As FileSystemEventArgs) MsgBox(e.FullPath) End Sub End Class When I run it and save changes to a file on my C drive, the code works great, except it executes the watcher_Changed() method four

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

和自甴很熟 提交于 2019-11-27 01:56:53
问题 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 someone will be willing to share. Ideally what I need is a class which can be used as follows: FileWatcher fw; fw.startWatching("C:\MYDIR", "filename.dat", FileWatcher::SIZE | FileWatcher::LAST_WRITE, &myChangeHandler); ... fw.stopWatching(); Or if

How to set filter for FileSystemWatcher for multiple file types?

时光毁灭记忆、已成空白 提交于 2019-11-27 01:12:24
问题 Everywhere I find these two lines of code used to set filter for file system watcher in samples provided.. FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Filter = "*.txt"; //or watcher.Filter = "*.*"; But I want my watcher to monitor more file types, but not all. How can I achieve this: //watcher.Filter = "*.txt" | "*.doc" | "*.docx" | "*.xls" | "*.xlsx"; I tried these: watcher.Filter = "*.txt|*.doc|*.docx|*.xls|*.xlsx"; // and watcher.Filter = "*.txt;*.doc;*.docx;*.xls;*.xlsx*"

How reliable is the FileSystemWatcher in .netFramwork 4?

我只是一个虾纸丫 提交于 2019-11-26 23:14:22
问题 Has anyone used the FileSystemWatcher in framework 4 and have you encountered any problems? i am using it in a windows service and i cant afford for it to fail. I have heard from a friend that it is not very reliable but I have been testing for a few hours now and i havent had any problems but i am still doubting using it..... i would appreciate any advice on this matter, i dont want to deliver the app to the the client and then realise that this thing is going to crash.... Thanks Thanks for