473,549 Members | 2,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatch er WinXP versus Win2003

Hi,
I have a C# program which creates a FileSystemWatch er and sets
IncludeSubdirec tories property to true with filter set to "*.txt". The
program runs fine under WinXP but in Win2003, it does not always work.
specifically another program is writing into the directory being
monitored by my app. When i do a copy from command prompt into the
directory, my app picks it up. But when the other app writes a file into
the directory being monitored, my app does not. All the testing i have
done with my app on XP involved the copying of the file or opening it
using notepad and saving it back. The NotifyFilter is set to LastWrite.
But i am capturing the Created and Changed events using:
_fsWatcher.Crea ted += new FileSystemEvent Handler(someFun c)
_fsWatcher.Chan ged += new FileSystemEvent Handler(someFun c)
where the someFunc is defined as a private void.
The copy does not work on the Win2003 but when i use notepad to save the
file on win2003, my app sees the event. I want my program to capture the
first time creation of the file on the directory and not when i use
notepad to save it.
Any ideas why the difference?
thanks,
BRAMOIN

*** Sent via Developersdex http://www.developersdex.com ***
May 7 '06 #1
1 1242
Hi,

Maybe your program is getting error when try to access the file ( it may be
still in used by the originator ). What if you put a try/catch with a
message or write to a log if you find a problem.
Also with that set of events you may get duplicated events being fired for
the same file, be aware of that.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Meya-awe" <br*****@yahoo. com> wrote in message
news:uz******** ******@TK2MSFTN GP02.phx.gbl...
Hi,
I have a C# program which creates a FileSystemWatch er and sets
IncludeSubdirec tories property to true with filter set to "*.txt". The
program runs fine under WinXP but in Win2003, it does not always work.
specifically another program is writing into the directory being
monitored by my app. When i do a copy from command prompt into the
directory, my app picks it up. But when the other app writes a file into
the directory being monitored, my app does not. All the testing i have
done with my app on XP involved the copying of the file or opening it
using notepad and saving it back. The NotifyFilter is set to LastWrite.
But i am capturing the Created and Changed events using:
_fsWatcher.Crea ted += new FileSystemEvent Handler(someFun c)
_fsWatcher.Chan ged += new FileSystemEvent Handler(someFun c)
where the someFunc is defined as a private void.
The copy does not work on the Win2003 but when i use notepad to save the
file on win2003, my app sees the event. I want my program to capture the
first time creation of the file on the directory and not when i use
notepad to save it.
Any ideas why the difference?
thanks,
BRAMOIN

*** Sent via Developersdex http://www.developersdex.com ***

May 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
260
by: calvin | last post by:
Can someone help me with the following problem: I have created a FileSystemWatcher (fsw) to monitor creation of *.tx file on a mapped directory (the directory is on a Win98 system) th application works fine (events are triggering) when it is running on WinXP system, but the same application did not get any event trigge when it is runnig on...
0
5630
by: hockeyove | last post by:
Hi! Little help needed... This is my environment: Server: Windows 2003 Client: Windows 2000 and Windows XP
1
3317
by: Troy Murphy | last post by:
How do I prevent the FileSystemWatcher event to keep firing while the file is being created? When copying a file to the watched folder, the event fires a dozen or more times! Also, the documentation states that if more than one file is copied to the folder at the same time, a cache will queue them up for processing, but when I drop 3 files...
3
5865
by: Frank Jiao | last post by:
I can get my local IPv6 address in Win2003 use the source code as below: string localName = Dns.GetHostName(); string address = ""; string scopeId = ""; IPHostEntry hostEntry = Dns.Resolve( localName ); foreach (IPAddress curAdd in hostEntry.AddressList) { if(curAdd.AddressFamily.ToString() ==
13
9124
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just multiple directories. I have hit a snag and don't know how to get around it. Basically I read in a list of directories from the app.config and...
3
14236
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 a working thread for processing the file, created a new FileSystemWatcher (as he said for real time processing), and then called the join method for...
20
4430
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 logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have...
5
5561
by: =?Utf-8?B?Sm9obiBT?= | last post by:
I am trying to find out if there is a way to tell if there is already a filesystemwatcher (created by a webservice) monitoring a folder. I have a webservice that creates a filesystemwatcher, monitors a folder and then returns the contents of the new/changed files. However, if the client app loses connection to the webservice without...
3
1516
by: bz | last post by:
Hi, I'm new to php, actually I used it fewtimes back in 2000, (v 4 at that time), but no longer since then I need to install it now on a WinXP or 2003 server on IIS, but I have troubles. I downloaded the MSI installer (version 5.2.4), run, it reported that installed ok, I created a virtual dir in IIS and added a php file there <HTML>
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7715
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7469
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.