filesystemwatcher

FileSystemWatcher files in subdirectory

╄→尐↘猪︶ㄣ 提交于 2019-11-30 03:57:51
问题 I'm trying to be notified if a file is created, copied, or moved into a directory i'm watching. I only want to be notified about the files though, not the directories. Here's some of the code I currently have: _watcher.NotifyFilter = NotifyFilters.FileName; _watcher.Created += new FileSystemEventHandler(file_created); _watcher.Changed += new FileSystemEventHandler(file_created); _watcher.Renamed += new RenamedEventHandler(file_created); _watcher.IncludeSubdirectories = true; _watcher

Finding the user who modified the shared drive folder files

喜你入骨 提交于 2019-11-29 23:21:00
问题 I have a shared drive which is elsewhere on a server. I want to get a notification which gives me the user name of the person who has modified any file present in the shared drive. Currently I am using the FileSystemWatcher to get the notification and the code provided by Stack overflow question "Find out username(who) modified file in C#" to find the user name. But Instead I get the name of the computer on which the shared drive is at the moment. I want the username who had modified the file

Node.JS: How does “fs.watchFile” work?

懵懂的女人 提交于 2019-11-29 22:26:18
According to the API docs for Node 0.4.3 , the fs.watchFile(filename, [options], listener) function starts a routine that will Watch for changes on filename . The callback listener will be called each time the file is accessed. It also says The options if provided should be an object containing two members a boolean, persistent , and interval , a polling value in milliseconds Which indicates that it will check every so often based on what is in interval. But it also says The default is { persistent: true, interval: 0 } . So does that mean it will check every millisecond to see if the file time

Notification callback in iOS when iTunes sync/file transfer is complete

懵懂的女人 提交于 2019-11-29 20:31:26
问题 I have searched for how to receive callbacks in iOS5 when the file system has changed. I've found the following sample from Apple's site, but it only notifies the given delegate when a file is removed/created. DirectoryWatcher class in the DocInteraction sample app http://developer.apple.com/library/ios/#samplecode/DocInteraction/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010052 Is there an API call that I can make to receive a "sync is complete" callback event? Note, a user might

Java nio FileSystem Watcher locks directories. Deletion becomes impossible [duplicate]

梦想的初衷 提交于 2019-11-29 19:07:02
问题 This question already has an answer here: Java7 WatchService - Access Denied error trying to delete recursively watched nested directories (Windows only) 1 answer I'm using the new feature of Java7 for watching directories for changes (as it is described in the following tutorial: http://download.oracle.com/javase/tutorial/essential/io/notification.html ) The watching itself works (nearly) without problems. More or less I have two issues and I hope some of you have an idea how to handle it.

FileSystemWatcher to execute .NET functions

假如想象 提交于 2019-11-29 16:45:16
I am creating a quick temporary fix so sorry if this is dirty, but- Objective I would like to use Powershells Register-Event cmd to wait for a file dropped in a folder, then call a function that parses the file and outputs it to excel. I don't need help with the coding aspect, just the concept. It is still a little mysterious to me as of where this Event is running and what resources it has to work with. Things I've Tried One .ps1 file with registered events at the bottom, calling a function at the top, called by a batch file. Behavior: Stops on this line: $sr = new-object System.IO

FileSystemWatcher issues

吃可爱长大的小学妹 提交于 2019-11-29 16:18:07
I am trying to use the FileSystemWatcher - and am having some luck.. The goal is to MOVE the file that gets created, from the monitored folder, to a new folder. But... have hit 2 snags. Firstly, if I move 3 files into a folder at once (Select 3 files, ctrl+x, and then ctrl+c into my Monitor Folder), the monitor only triggers for the first file. The other 2 don't get processed. FileSystemWatcher fsw = new FileSystemWatcher(FolderToMonitor); fsw.Created += new FileSystemEventHandler(fsw_Created); bool monitor = true; while (monitor) { fsw.WaitForChanged(WatcherChangeTypes.All, 2000); if (Console

What is the impact of a FileSystemWatcher on a hard drive?

柔情痞子 提交于 2019-11-29 15:32:10
I've used FileSystemWatcher in the past. However, I am hoping someone can explain how it actually is working behind the scenes. I plan to utilize it in an application I am making and it would monitor about 5 drives and maybe 300,000 files. Does the FileSystemWatcher actually do "Checking" on the drive - as in, will it be causing wear/tear on the drive? Also does it impact hard drive ability to "sleep" This is where I do not understand how it works - if it is like scanning the drives on a timer etc... or if its waiting for some type of notification from the OS before it does anything. I just do

Powershell and System.IO.FileSystemWatcher

余生长醉 提交于 2019-11-29 15:16:42
问题 I am new to PowerShell and I am trying to use the System.IO.FileSystemWatcher to monitor the presence of a file in a specified folder. However, as soon as the file is detected I want to stop monitoring this folder immediately and stop the FileSystemWatcher. The plan is to incorporate the PowerShell script into a SQL Agent to enable users to restore their own databases. Basically I need to know the command to stop FileSystemWatcher from monitoring as soon as one file is found. Here is the

WPF - Cannot change a GUI property inside the OnChanged method (fired from FileSystemWatcher)

可紊 提交于 2019-11-29 14:31:10
I want to change a GUI property in the OnChanged method... (in actuality im trying to set an image source.. but used a button here for simplicity). This is called everytime filesystemwatcher detects a change in a file.. and it gets to the "top" output.. but catches an exception when it tries to set the button width. but if i put the same code in a button.. it works just fine. I sincerely don't understand why.. can someone help me? private void OnChanged(object source, FileSystemEventArgs e) { //prevents a double firing, known bug for filesystemwatcher try { _jsonWatcher.EnableRaisingEvents =