• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Probelm in FTP ing a FIle

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I have a problem in FTP ing a file.The scenario is as follows:

I have a folder "temp" which holds n number of files and every file has a name in the form "TEST.20050720T1620511325.XML.pgp" The numbers in between signifies the date of the present day followed by T which signifies time , followed by the time when the file was sent by X party to the temp folder.

My FTP program needs to read the latest file for the day.It means out of 10 files i need to pick the latest file and that needs to be FTPed.

So can anyone help me with some sample code which allows me to pick the latest file.

Actually temp folder daily gets one file from X party, so it will hold collection of such files.



Thanks in advance,
Saurabh
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the files are all named in this predictable fashion, you can just iterate over all files, compare their names, and use the name that is "larger" than all other ones, as determined by String.compareTo().
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic