How to find out if ftp loading through ruby ​​is successful?

The following code downloads the file via ftp and it works.

require 'net/ftp' ftp = Net::FTP.new ftp.passive = true ftp.connect("***") ftp.login("***","***") ftp.chdir "claimsecure-xml-files" ftp.putbinaryfile("file.xls",File.basename("file.xls")) ftp.quit 

But how can I assure you that the download was successful?

+6
ruby ftp
source share
4 answers

Roughly - you can "get" the file back and ensure it is the same ...

+1
source share

after

  ftp.putbinaryfile("file.xls",File.basename("file.xls")) 

Check

  puts ftp.last_response 
+4
source share

Can we do this?

 unless ftp.size('file.xls') == File.size('file.xls') do #Repeat! end 
+1
source share

you can upload a dummy file after loading your excel file. Then do a listing and make sure you have this dummy file. just an idea.

0
source share

All Articles