Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Problem in Checking file transfer completion throgh FTP

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do we know if the file has been transferred completely?
Our application monitors for File arrivals at a specific FTP folder.
Our application uses JBOss Sceduler with 2 minute time interval between each monitoring event.
Basically, our external client drops files in that FTP folder and our application picks them (Using Commons FTP util).
Question: When we download these files from FTP folder, if client is dropping a big file at the same time,
does Commons FTP utils ignore that file since it is still not complete? or does commons FTP API gets this incomplete file (only what ever available at that time?).
Is there a way to know if the cliet file dropping is complete?
Thanks a lot for the help
Posts: 22511
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The file is physically there, just not complete. As such there is no way to distinguish between a completed file and a non-completed file, except from the program that is actually downloading / uploading - since that is the only one that knows how big the file should actually be.

If you can't control the upload / download process I fear there is very little you can do. Perhaps you can go to the Operating System level and check which files still have some locks, but that requires native code and I'm not even sure that downloaded files have file handles. I can at least try to read them while they are downloaded (with Opera or FTP), while there are programs that will actually lock a file completely (database servers for instance).

Edit: I just tested with both Opera and Total Commander (my FTP program) and both keep a handle open. Guess that is the way to go.
[ October 01, 2008: Message edited by: Rob Prime ]
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A project I had in the past faced a similar problem. We had one service that downloaded the files and a different service that processed them.
The simplest way we found to get around the problem was to mark the files as read only after they were downloaded. The processing service could then check the flags on the files and only process read only files.

Its a simple solution but it may be worth looking into?
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic