rebol [ Title: "Demo batch-download" File: %demo-batch-download.r Date: 5-Sep-2006 Version: 1.0.3 Progress: 0.5 Status: "working" Needs: [View] Author: "Anton Rolls" Language: 'English Purpose: {Show how to use the batch-download function} Usage: {} History: [ 1.0.0 [8-Jan-2004 {First version} "Anton"] 1.0.1 [13-May-2006 {removed a whole bunch of accumulated urls to a separate file} "Anton"] 1.0.2 [16-May-2006 {updated examples for new batch-download.r version 1.0.3} "Anton"] 1.0.3 [5-Sep-2006 {added some FTP urls for testing} "Anton"] ] ToDo: { - } Notes: {} ] system/options/quiet: true user-prefs/debug: none site: select load-thru http://www.rebol.net/reb/index.r [folder "Anton"] clear find site %index.r do load-thru site/library/include.r include [ site/util/batch-download.r [batch-download] ] ;user-prefs/debug: true ; show additional debug information urls: [ ; RoPS PostScript Viewer for Windows - 324 Kb ; the installer for RoPS, a free Windows PostScript viewer. preview PostScript files and print them to non-PostScript printers. http://www.rops.org/download/freescript53.exe ; TrueType PostScript Font package (zipped) - 937 Kb ; a package of public domain postscript fonts. (copy the fonts to the Windows fonts directory.) http://www.rops.org/download/std35ttf.zip ; MikTeX - LaTex For Windows installer - 36 Mb ; a typesetting program ; http://easynews.dl.sourceforge.net/sourceforge/miktex/basic-miktex-2.4.2207.exe ; A couple of FTP urls for testing ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/gs853/gs853w32.exe ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv48w32.exe ] {urls: [ http://superb-west.dl.sourceforge.net/sourceforge/firebird/Firebird-1.5.3.4870-0-Win32.exe http://internap.dl.sourceforge.net/sourceforge/firebird/Firebird_ODBC_1.2.0.69-Win32.exe http://www.synapsedirect.com/files/builds/REMR.zip http://www.synapsedirect.com/files/builds/SynapseEMR_Express_Server.msi http://www.compkarori.com/emr/express-client-files.txt http://www.synapsedirect.com/files/builds/SynapseEMR%20Client.exe http://www.synapsedirect.com/files/builds/growth.zip http://easynews.dl.sourceforge.net/sourceforge/miktex/basic-miktex-2.4.2207.exe http://www.rops.org/download/std35ttf.zip http://www.rops.org/download/freescript53.exe ]} download-directory: %"/L/EMR downloads/" confirm-file-sizes: does [ print "Confirming file sizes" foreach url urls [ file: join download-directory last split-path url info1: all [info: info? url info/size] info2: all [info: info? file info/size] print [either info1 = info2 ["[ OK ] "]["[ BAD ] "] url] ] ] ; Simplest usage ;batch-download urls ; Specify a directory to save files into ;batch-download/to-dir urls download-directory ; A block of completed urls is returned, so we can inspect it to see what our success was like. completed-urls: batch-download/to-dir urls download-directory print [ "Complete downloads:" mold completed-urls "^/Incomplete downloads:" mold exclude urls completed-urls ] confirm-file-sizes