D
Dy Dymy
i have tried combining all what i research...
#code starts here:
listofFile = [ ... ] #<-- internet files like PDF, etc...
listofFile.each do |each_file|
fileBaseName = File.basename(each_file)
filePath = Dir.pwd + '/' + fileBaseName
begin
if File.exist?(fileBaseName) != true
openFileRead = open(each_file)
else
puts "message: File already exist = #{fileBaseName}"
end
rescue
retry
else
begin
writeOut = open(filePath, 'wb+')
#<-- if internet cuts here, how do i know if its completely downloaded
writeOut.write(openFileRead.read)
rescue => err
puts err.message
puts "error: #{each_file} -- download error."
else
writeOut.close
end
end
end
# code ends here
actually i have internet connection problem here... if the cuts the file
will be corrupted...
please advice me.. or do i miss something...
thanks
#code starts here:
listofFile = [ ... ] #<-- internet files like PDF, etc...
listofFile.each do |each_file|
fileBaseName = File.basename(each_file)
filePath = Dir.pwd + '/' + fileBaseName
begin
if File.exist?(fileBaseName) != true
openFileRead = open(each_file)
else
puts "message: File already exist = #{fileBaseName}"
end
rescue
retry
else
begin
writeOut = open(filePath, 'wb+')
#<-- if internet cuts here, how do i know if its completely downloaded
writeOut.write(openFileRead.read)
rescue => err
puts err.message
puts "error: #{each_file} -- download error."
else
writeOut.close
end
end
end
# code ends here
actually i have internet connection problem here... if the cuts the file
will be corrupted...
please advice me.. or do i miss something...
thanks