473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

FileSystemWatcher Class in .Net

308 256MB
Hi,

I want to use this "FileSystemWatcher " class in my project but I am not able to decide at which moment should i use it.. Can anyone help me?

Here is the scenario.

My Application consist of the service which is continuously running and some other modules .When my project get installed there are some files which the server continuously updates.I want to keep track of this using FileSystemWatcher.But where should i this ( use of FileSystemWatcher).. in modules or in the service..so that i will get the continuous updates about changing of the files ?

Thanks!
Sep 22 '08 #1
3 1556
PRR
750 Expert 512MB
My Application consist of the service which is continuously running and some other modules .When my project get installed there are some files which the server continuously updates.I want to keep track of this using FileSystemWatcher.But where should i this ( use of FileSystemWatcher).. in modules or in the service..so that i will get the continuous updates about changing of the files ?

Thanks!
if the files are continuously updated then u could use :
OnChanged

For more info
FileSystemWatcher
Sep 22 '08 #2
cloud255
427 Expert 256MB
If you intend to watch real time changes, i suggest using your service. But do beware of access violations, these tend to happen if you are not careful with the code you use when handeling the FileSystemWatcher events, often the file is still in use when the events are raised...
Sep 22 '08 #3
tlhintoq
3,525 Expert 2GB
If you intend to watch real time changes, i suggest using your service. But do beware of access violations, these tend to happen if you are not careful with the code you use when handeling the FileSystemWatcher events, often the file is still in use when the events are raised...
A good example of that is the OnCreate event. It fires as soon as new file is created:Not necessarily when it is DONE being written. So if you try to open it while it is still being written from another source.... [ugliness ensues]

I find I never actually handle any file from OnCreate or OnChange, but rather add the file to a list to be processed, which is handled every xx seconds. If a file on the list is free then I can process it then remove from list. If not, move to the next file on the list. But that's just me.
Sep 23 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know...
2
by: Jet Leung | last post by:
Hi all, I had made a program to watching files in my directory. I had used a instance of FileSystemWatcher to do my work.And I had add some events of the FileSystemWatcher , for example onChange,...
3
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started...
3
by: Krish | last post by:
Hello Gurus, Pardon me for asking dumb question... I wrote small csharp program to watch a folder for any created text file... When i try to run through debugger and stop after "...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
1
by: teslar91 | last post by:
I've been learning VB.NET for the past few weeks. One of the problems I've run into is difficulties updating controls in events from certain components, such as the FileSystemWatcher, that raise...
1
by: Asko Telinen | last post by:
Hi all. I ran into quite strange problem concerning the event raising inside FileSystemWatcher Delete event. First, i would like to describe a bit my environment. I have main GUI...
15
by: Angelo | last post by:
Hi all, I'm using a FileSystemWatcher to monitor a directory. I want the FSW to pop up my already instantiated but invisible form. However, I'm running into some problems with this. 1) In...
2
by: - HAL9000 | last post by:
This web page on FileSystemWatcher Class in .net 2.0 says that the class works on a win98 platform. http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(VS.80).aspx I know for...
7
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hello, I've got a FileSystemWatcher object setup to check for new files in a folder. I've never done much with threading, but I think I mght need to here. When I find a new file there are times...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.