473,505 Members | 16,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatcher behaviour

I would use the filesystemwatcher to trap files changes into a specific
directory.
I take a look on the possible message, and 'cause I need to know only
when a files finishede to have been copy, I user the LastAccess
message.

I do a simple project, and there all works fine. So I moved all into
the main project, a service. I then installed the FTP service on the
working pc and did a try. Unfortunately running this sample (the
machine is the same of the previous test) there the message if fired
just after the file is created.

I don't know why the behaviour occur. Certainly LastAccess doesn't mean
last byte written, and file system architecture is quite different from
what you think I'm thinking, I know. My question is just to know how
this strange thing happen.

A part of all. I thinked to solve the problem (know when file has been
completely write) using a timer. When the file system event fires I add
an entry into an hashtable or bi-dimensional array, in which I take
trace of file's name and date-time, then fires the timer every 10
seconds. If, for example, for 3 times the last-access time stored in
the array hasn't been changed, I can consider the file written (well or
not, this certainly could be another problem, but because I'll zip
file, if it won't be completely written, it'll certainly unreadable).

What do you think of that?

Thanks Andrea

Nov 21 '05 #1
1 912
"vodafone" <vo*******@tiscali.it> schrieb
I would use the filesystemwatcher to trap files changes into a
specific directory.
I take a look on the possible message, and 'cause I need to know
only when a files finishede to have been copy, I user the LastAccess
message.

I do a simple project, and there all works fine. So I moved all into
the main project, a service. I then installed the FTP service on the
working pc and did a try. Unfortunately running this sample (the
machine is the same of the previous test) there the message if fired
just after the file is created.

[...]

Have a look @ this group for language unrelated questions:
microsoft.public.dotnet.framework
Armin
Nov 21 '05 #2

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

Similar topics

1
3304
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...
7
4095
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...
13
9114
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...
3
14222
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...
20
4415
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...
12
7417
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
1
1871
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...
5
5551
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,...
2
1701
by: Soulless | last post by:
Hi, I implemented the FileSystemWatcher in an application and on my XP system it works fine. If I add a file to a directory, it will enable a button and disable if removed. On another XP system...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7021
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...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
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,...
1
5035
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...
0
4701
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...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.