473,403 Members | 2,323 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,403 software developers and data experts.

filesystemwatcher Big Question

Hello All

I am working on an application that watches a folder for incomming files. The files happen to be tif files from a fax card. When the file comes in I want to move it to a different file.

My problem is when the even fires it trys to move the file BUT the file has not had time to compleatly transfer / save so I get an error. Is there a way to determine if a file it TOTALY there before I try to move it

watchfolder = New System.IO.FileSystemWatche
watchfolder.Path = UserPrefs.FromFolde
watchfolder.NotifyFilter = IO.NotifyFilters.FileName Or NotifyFilters.LastAcces
AddHandler watchfolder.Created, AddressOf NewFileCreate
watchfolder.EnableRaisingEvents = Tru

thank
Bra

Nov 20 '05 #1
2 1040
* "=?Utf-8?B?QnJhZA==?=" <an*******@discussions.microsoft.com> scripsit:
My problem is when the even fires it trys to move the file BUT the
file has not had time to compleatly transfer / save so I get an
error. Is there a way to determine if a file it TOTALY there before I
try to move it?


No.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
You could afterall use a temporary file situation, name it something like
$$$MyFile.tmp

and then when you have it completed, rename the file and listen on the
rename event... this way, the rename event wont fire until after the
operation is complete and you can guaruntee the files complete existance.

peace,
cj

"Brad" <an*******@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Hello All,

I am working on an application that watches a folder for incomming files. The files happen to be tif files from a fax card. When the file comes in I
want to move it to a different file.
My problem is when the even fires it trys to move the file BUT the file has not had time to compleatly transfer / save so I get an error. Is there a
way to determine if a file it TOTALY there before I try to move it?
watchfolder = New System.IO.FileSystemWatcher
watchfolder.Path = UserPrefs.FromFolder
watchfolder.NotifyFilter = IO.NotifyFilters.FileName Or NotifyFilters.LastAccess AddHandler watchfolder.Created, AddressOf NewFileCreated
watchfolder.EnableRaisingEvents = True
thanks
Brad

Nov 20 '05 #3

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...
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
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:
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...
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...
0
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
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
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,...
0
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...

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.