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