[REBOL] Reliable FTP of large binary files with REBOL/Core 2.5
From: doug::vos::eds::com at: 5-Apr-2002 18:22
Just completed three successful tests with this code:
;---------------------------------------------------------------------------
Transfered 160 Meg zip file in 4 minutes 53 seconds
(650 megs unzipped).
164205447
FTP Transfer took: 0:04:53
>>
;--------------------------------------------------------------
modified from code by someone at rebol tech
and Petr K.
REBOL []
ftp-large-binary-file: func [
{FTP large binary files - like the name says.
Could actually be used/modified to transfer large files without ftp
or using some other protocol...}
ftp-site [url! file!] {The ftp site we are getting file from.}
xfile-to [url! file!] {The target file we are writing to.}
/local buf-size buffer source target total size start
][
buf-size: 64000
buffer: make string! buf-size
source: open/binary/direct ftp-site
target: open/binary/new/direct xfile-to
total: 0
size: 0
start: now/time
while [not zero? size: read-io source buffer buf-size][
write-io target buffer size
clear buffer
total: total + size
print total
]
close source
close target
print ["FTP Transfer took: " now/time - start ]
]
;---------------------------------------------------------------------------
-----------
ftp-site: ftp://your.big.server.com/big-file.zip
lfile: %/d/data/local/big-file.zip
ftp-large-binary-file ftp-site lfile