-
-
Save wicky-andrian/ddafde49f515e9b95ba2a8a7597b1e25 to your computer and use it in GitHub Desktop.
Download File on FTP Server with Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ref: https://ruby-doc.org/stdlib-2.5.3/libdoc/net/ftp/rdoc/Net/FTP.html | |
require 'net/ftp' | |
Net::FTP.open('ftp.gnu.org') do |ftp| | |
ftp.login | |
ftp.chdir('gnu/wget') | |
nlst = ftp.nlst('*.tar.gz') | |
nlst.map {|file_name| ftp.gettextfile(file_name) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment