FTP File download

B

Brian Scott

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.

Any Ideas

Thanks
 
J

Jano Svitok

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/)
 
R

Robert Citek

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top