filesystemwatcher

FileSystemWatcher - event not firing the second time

∥☆過路亽.° 提交于 2019-12-08 18:18:35
问题 I have an application that launches other applications, and then waits for them to create a specific data file (it watches one application at a time). Each time an application is launch it watches a specific directory for a specific file to be created. I am using the FileSystemWatcher to do this (set it to the directory, then filter for the correct file name). This works great the first time (always), but the second application launched never fires the event. The only way it seems to fire the

Monitor a directory with FileSystemWatcher

主宰稳场 提交于 2019-12-08 11:05:15
问题 I have a directory which is getting filled by some program. I would like to monitor this directory and check if files are continuously getting added to the directory. If for Example for 5 min no file is getting added to the direcotry I want to get notified. The Files are also getting deleted but i just have to care about the new files. The script would run for about 20 min every three hours. The code for the FileSystemWatcher: $watcher = New-Object System.IO.FileSystemWatcher $watcher.Path =

FileSystemWatcher.WaitForChanged returns, but there is still a lock on the file

主宰稳场 提交于 2019-12-08 10:06:55
问题 I have a program that send a document to a pdf printer driver and that driver prints to a particular directory. After the print I want to attach the pdf to an e-mail (MailMessage) and send it off. Right now, I send the document to the printer (wich spawns a new process) and then call a FileSystemWatcher.WaitForChanged(WaitForChangedResult.Created) but when the object is created, it's still not done "printing" and the pdf printer still has a lock on it, throwing an error when I try to attach

how come osx kernel get so many times of file operations

早过忘川 提交于 2019-12-08 09:18:01
问题 I create a file in userspace(using touch command), I am expecting to see only one OPEN and one CLOSE file operations, however, I get 2 OPEN and 3 CLOSE operations from kernel notification. the operations sequence is like this: open --> close --> open --> close ---> close.... can anybody give me some hints about this? thanks in advance. 回答1: Kauth vnode and fileop listeners have been working well for me. If you are receiving event notifications that don't make sense to you, I suggest placing a

C# FileSystemWatcher WaitForChanged Method only detects one file change

一个人想着一个人 提交于 2019-12-08 07:02:45
问题 I got a problem similar to this one: FileSystemWatcher - only the change event once firing once? But since that thread is two years old and my code is a bit different, I decided to open a new question. Well, here's my code: while (true) { FileSystemWatcher fw = new FileSystemWatcher(); fw.Path = @"Z:\"; fw.Filter = "*.ini"; fw.WaitForChanged(WatcherChangeTypes.All); Console.WriteLine("File changed, starting script..."); //if cleanup try { if (File.ReadAllLines(@"Z:\file.ini")[2] == "cleanup")

FileSystemWatcher to monitor moved files [duplicate]

♀尐吖头ヾ 提交于 2019-12-08 05:57:49
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Detecting moved files using FileSystemWatcher I'm trying to monitor moved files with the FileSystemWatcher, and got some help on the way here: Using FileSystemWatcher with multiple files However, I found I had to be able to use both the Deleted and the Created events in order to get the paths from where the files have been moved as well as the path to where they have been moved. But when I add similar code for

OSGi noClassDefFound for java.nio.files.FileSystems$DefaultFileSystemHolder

非 Y 不嫁゛ 提交于 2019-12-08 04:26:32
问题 in our application, we're using ini files for the configuration of our OSGi apps. Now I thought about adding a WatchService to detect changes and reload the modified file if necessary. I found multiple tutorials so far. Most of them are similar and result in something like the following: http://java.dzone.com/news/how-watch-file-system-changes. I adopted it like this: 36: public Ini(final File file) throws IOException { if (!file.exists()) { throw new IOException("Ini-File does not exist.");

LastWrite FileSystemWatcher Powershell: notification

送分小仙女□ 提交于 2019-12-07 20:14:53
问题 I would like to get an Notification when a certain file where changed. It works fine but I can't set the NotifyFilter. "is not recognized as the name of a cmdlet..." The main problem is: That my script goes twice in my function. A change is identified and then I get two times "changed" function fileChanged ($text) { Write-Host $text } $watcher = New-object System.IO.FileSystemWatcher "C:\Users\test\Desktop\" $watcher.EnableRaisingEvents = $true $watcher.Filter="*.txt" $watcher.NotifyFilter =

PHP folder watching on windows

你离开我真会死。 提交于 2019-12-07 16:23:12
问题 I am writing a simple PHP script to watch a folder and its subfolders for any changes (new files, modifications, deletions) and then perform an action. I will run this script from the commandline on windows using php -f script.php . I have been search for a way to watch folders on windows that has PHP bindings. Something like inotify or gamin for windows would be nice. The answers to this question mentions FindFirstChangeNotification , but I couldn't find any PHP bindings for it. Are there

FileSystemWatcher running under impersonated user

a 夏天 提交于 2019-12-07 14:34:01
问题 I have an c# winform application that runs under a local account but needs to monitor folders on a domain. I am using slightly modified code from here to copy the files and that works fine. Can similar code be used with the FileSystemWatcher set up impersonation so I can monitor a folder on a domain? 回答1: Yes, there is a good impersonation class here, include this class in your project and than simply place your FileSystemWatcher within a using block like this: using ( new Impersonator(