p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Pro VB 6 (http://p2p.wrox.com/forumdisplay.php?f=73)
-   -   Monitoring files (http://p2p.wrox.com/showthread.php?t=739)

rylemer June 19th, 2003 11:50 AM

Monitoring files
 
Im creating a program to watch folder downloaded from a FTP site.
When the transmission is complete I'll move the files in to another Directory.
Currently I used a FileSystem object to monitor the files that been put in the directory but evertime I start downloading the files it shows the filename and the transmission is not complete, then If I move it the file is corrupt.
How can I know if the transmission is complete.

If you have any ideas on a better way to know the transmisson is complete I would like to here from you.



Thanks
Elmer

gbianchi June 19th, 2003 12:12 PM

hi there...
a couple of quick ideas...

build an output file.. monitor that file.. and when a download is complete write a line there so you now that the file is ready..
build another file while an extention like .XXX so you know that the file is ready when this file disapear (or make this file apear when you finish the download)...

HTH..


Gonzalo Bianchi

marcostraf June 19th, 2003 05:27 PM

Gonzalo, that is a good technique if you know when the ftp is done, but it
does now work if someone else is sending the file.
I was struggling to find out a way to know that a file is still is use,
and at the end I used the following: I check the size of the file, and
if does not grow in the last five minutes (or if another file has been
downloaded) I consider the transmission done. Not great, but it works
in my case.

Marco

jlick June 19th, 2003 06:12 PM

I would expect that while the FTP is going on, the file is locked for writing. That being the case, when you discover the filename, before you start copying it, couldn't you try to open for append. If the open for append raises an error then the FTP is not complete. If the open for append doesn't raise an error, then close it and copy it.

John R Lick
JohnRLick@hotmail.com

marcostraf June 19th, 2003 07:08 PM

This is what I would have expect as well... but it was not true in all cases!

Marco

Quote:

quote:Originally posted by jlick
 I would expect that while the FTP is going on, the file is locked for writing. That being the case, when you discover the filename, before you start copying it, couldn't you try to open for append. If the open for append raises an error then the FTP is not complete. If the open for append doesn't raise an error, then close it and copy it.

John R Lick
JohnRLick@hotmail.com

rylemer June 20th, 2003 10:13 AM

thanks for replying to my post message I'll try all your Ideas. and anyone will give me more technique I really appreciate.


All times are GMT -4. The time now is 08:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.