Mega Code Archive

 
Categories / Ruby / Network
 

Connecting to an FTP server with netftp using an FTP URL is a simple operation

require 'net/ftp' require 'uri' uri = URI.parse('ftp://ftp.ruby-lang.org/') Net::FTP.open(uri.host) do |ftp|   ftp.login 'anonymous', 'me@privacy.net'   ftp.passive = true   ftp.list(uri.path) { |path| puts path } end