On Dec 6, 2007 5:27 AM, Jano Svitok <jan.svitok / gmail.com> wrote:
> On Dec 6, 2007 6:29 AM, Brian Scott <cuiguy / network32.net> wrote:
> > Hello,
> >
> > I am a Ruby Newbie
> >
> > I need to login to a ftp server and download the newest file on the
> > server. I know the basics of Net::FTP but I can't figure out how to
> > download the newest file based on its time stamp.
>
> FTP#list gives you list of files, possibly with timestamps, and
> FTP#mtime gives you last modification time of a particular file.
>
> RTFRDoc ;-) (e.g. http://ruby-doc.org/core/)

Thanks for the link to the docs.  Here's the one for NET::FTP:

http://ruby-doc.org/core/classes/Net/FTP.html

Unfortunately, I can't get the example to work for me.  Specifically,
this worked:

$ ruby -le 'require "net/ftp" ; print "hello"'

but this does not, i.e. it just sits there:

$ ruby -le 'require "net/ftp" ; ftp = Net::FTP.new("ftp.netlab.co.jp")
; print "hello"'

So I changed to an ftp server that I know works, i.e. I can connect to
it via firefox:

$ ruby -le 'require "net/ftp" ; ftp =
Net::FTP.new("ftp.ncbi.nlm.nih.gov") ; print "hello"'

Still no dice.  It's possible that this is because I'm behind a
firewall? ftp_proxy is set
to something like "http://proxy.foobar.com:12345" and I've issued an
'export SOCKS_SERVER=$ftp_proxy', but ruby still doesn't work for me.

FYI:

$ ( set -x ; ruby -v ; cat /etc/issue.net )
+ ruby -v
ruby 1.8.5 (2006-08-25) [i486-linux]
+ cat /etc/issue.net
Ubuntu 7.04

Any pointers in the right direction appreciated.

Regards,
- Robert