Download and read the file using net/ftp
require ‘rubygems’
require ‘net/ftp’
ftp=Net::FTP.new(‘100.444.211.144’)
ftp.login
ftp.chdir(“/Main_flder/Sub_folder1/Sub_folder2/”)
fileList = ftp.nlst(‘*.txt’) #instead of .txt you can use any file extension
filedata = ‘ ‘
ftp.retrlines(“RETR ” + fileList[0]) do |block|
filedata << block
end
puts filedata # It will print the content of the entire TEXT FILE