473,382 Members | 1,348 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,382 software developers and data experts.

FileSystemWatcher question

Hi!

FileSystemWatcher raises 'Created' event immediately after the file has been
created - and what if someone transfers a very large file? Is there a bether
way to detect end of transmission than:

// --- wait for file transfer completed
while (! TryToOpenInExclusiveMode())
{
Sleep(someTime);
}
// --- file transfer completed

Best regards,
Piotrek

Jul 22 '05 #1
1 1341
"Piotr Szukalski" <am*****@SPAM-AWAYpoczta.onet.pl> wrote in message
news:pa****************************@SPAM-AWAYpoczta.onet.pl...
Hi!

FileSystemWatcher raises 'Created' event immediately after the file has been created - and what if someone transfers a very large file? Is there a bether way to detect end of transmission than:

// --- wait for file transfer completed
while (! TryToOpenInExclusiveMode())
{
Sleep(someTime);
}
// --- file transfer completed


This is more or less how I've done it in the past. I create my own
FileSystemWatcher that mimicks the interface of the .Net one. The difference
being that I only fire the created event when I can get an exclusive lock.

There may be a better way, it's just never been a big enough problem before.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Jul 22 '05 #2

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

Similar topics

2
by: Hardy Wang | last post by:
Hi, I have a FileSystemWatcher object to monitor one certain folder on server. FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = @"C:\MyFolder"; watcher.NotifyFilter =...
13
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
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 "...
1
by: Terry | last post by:
I have created a Windows Service application which uses FileSystemWatcher to monitor multiple folders and file filters. These folders/files are loaded from a database table. When a Change Event...
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: dinny | last post by:
Question about FileSystemWatcher: How can I determine if a delete notification was a file or a directory. I was using the DirectoryInfo.exists method to determine if I am receiving file or...
9
by: Tushar | last post by:
Followup-To: microsoft.public.dotnet.general Does anyone know when is this event raised, is it: 1) When the file is created but may not have been closed 2) When the file is created AND it has...
3
by: =?Utf-8?B?RGFuaWVs?= | last post by:
I'm working with the FileSystemWatcher which has a Created event. But this event is raised as soon as the new file begins to be written on disk. What I want is a notification after a file being...
5
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,...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.