Ruby Download File via FTP

Ruby Download File via FTP

Download files from FTP server is quite easy using Ruby.

Example:

1
2
3
4
5
6
7
8
require 'net/ftp'

ftp = Net::FTP.new
ftp.connect("your_host_name.com", 21)
ftp.login("your_username","your_password")
ftp.chdir("/your_directory")
ftp.passive = true
ftp.getbinaryfile("your_source_file", "your_dest_file")

So far so good, That’s it! See ya! :)