filesystemwatcher Big Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
* "=?Utf-8?B?QnJhZA==?= said:
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.
 
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 said:
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?
 
Back
Top