Ruby 设置 FTP 传输模式为 Passive

require 'net/ftp'

ftp = Net::FTP.new('ftp.ruby-lang.org')
ftp.passive = true
ftp.login(username, password)

ftp.delete(filename)

ftp.list('*') { |file| puts file }
ftp.close

编程技巧