TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ivesorange
NA
1
0
Problem about FileSystemWatcher..
Jul 18 2004 3:51 AM
Hi.. I want to know about file creation,modification and deletion on the disk. I got the code below from MSDN. ======================================================= FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = "d:\\"; watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName; watcher.Filter = "*.*"; watcher.IncludeSubdirectories = true; watcher.Changed += new FileSystemEventHandler(OnChanged); watcher.Created += new FileSystemEventHandler(OnChanged); watcher.Deleted += new FileSystemEventHandler(OnChanged); watcher.Renamed += new RenamedEventHandler(OnRenamed); watcher.EnableRaisingEvents = true; private static void OnChanged(object source, FileSystemEventArgs e) { Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType); } ======================================================= But when I run this program, I created a new file and saved it. I got the message below: File: d:\new text document.txt Created File: d:\new text document.txt Changed File: d:\new text document.txt Changed I just saved one time,but it got twice event. How can I fix this problem. And it sometimes gets directories changed message, Why??
Reply
Answers (
0
)
run batch file
Compare Types