Ruby 连接并登录到 FTP 服务器

2019PHP高薪工程师学习路线图....>>>

require 'net/ftp'
require 'uri'

uri = URI.parse('ftp://ftp.ruby-lang.org/')

Net::FTP.open(uri.host) do |ftp|
  ftp.login 'anonymous', [email protected]'
  ftp.passive = true
  ftp.list(uri.path) { |path| puts path }
end