[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Net/FTP: failed download creates empty file

Ronald Fischer

6/5/2007 12:01:00 PM

I'm downloading a file via FTP like this:

require 'net/ftp'
ftp=Net::FTP.new(hostname,userid,password)
begin
ftp.getbinaryfile('fluffi')
rescue Net::FTPPermError
puts "download #{filename} failed (#{$!.to_s.chomp})"
end

This works basically fine, with one minor glitch: If the file ('fluffi')
does not
exist (i.e. the exception is thrown - "download fluffi failed (550 Can't
open
fluffi: No such file or directory)"), there is still a file 'fluffi'
created
with length 0.

Is this a bug or intended behaviour?

Ronald
--
Ronald Fischer <ronald.fischer@venyon.com>
Phone: +49-89-452133-162