home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / comm / getffran.rex < prev    next >
OS/2 REXX Batch file  |  1993-02-27  |  4KB  |  180 lines

  1. /* ARexx script to get a range of FF disks from ftp site */
  2.  
  3. /* Search for three asterisks to get to the section you need to modify
  4.    Then delete comment out these two lines below... */
  5. SAY 'You must edit this script to set some values...  Aborting...'
  6. exit
  7.  
  8. /* Written by
  9.       Nickey MacDonald  (i6t4@jupiter.sun.csd.unb.ca)
  10.       February 24, 1993
  11.  
  12.    This script is written in AREXX for the AREXX port of TERM (2.4a).
  13.  
  14.    This script was written to work with the ux1.cso.uiuc.edu anonymous
  15.    ftp archive of the Fred Fish Disks.  Its directories are as follows:
  16.  
  17.       /amiga
  18.          /fishdoc
  19.             /f3
  20.                Contents.3xx
  21.             /f4
  22.                Contents.4xx
  23.             /fy
  24.                Contents.yxx
  25.          /fish
  26.             /f5
  27.                /ff5xx
  28.                   *.lzh
  29.             /f6
  30.                /f6xx
  31.                   *.lzh
  32.             /fy
  33.                /fyxx
  34.                   *.lzh
  35.  
  36.    This script should be easily modified to handle another site with a
  37.    similar organization...  especially if its just changing a few of the
  38.    defined variables at the start.
  39. */
  40.  
  41. /*** Some configurable values - You will have to change some of these ***/
  42. ANONPWD='dumb-user@didnt-edit'            /* Mail address - Anon ftp pass */
  43. USERPROMPT='jupiter'                      /* Part of users csh prompt */
  44. WHEREDIR='/tmp/i6t4'                      /* Where to put fish disks */
  45. FTPSITE='ux1.cso.uiuc.edu'                /* The site to use */
  46. DOCDIR='/amiga/fishdoc'                   /* Where the contents files are */
  47. DISKDIR='/amiga/fish'                     /* Where the fish disks are */
  48. TIMEOUT='10 min'                          /* How long to WAITSTRING */
  49.  
  50. /* Allow results to be returned */
  51. OPTIONS RESULTS
  52.  
  53. ADDRESS TERM
  54.  
  55. SAY 'What range of FF disks do you want to fetch?'
  56.  
  57. /* Get starting disk number */
  58. RESULT=""
  59. 'GETSTRING "Starting FF disk number?"'
  60. startval=RESULT
  61.  
  62. if DATATYPE(startval, 'N') = 0 then
  63. do
  64.    SAY 'Disk number must be numeric.'
  65.    exit
  66. end
  67.  
  68. /* Get ending disk number */
  69. RESULT=""
  70. 'GETSTRING "Ending FF disk number?"'
  71. endval=RESULT
  72.  
  73. if DATATYPE(endval, 'N') = 0 then
  74. do
  75.    SAY 'Disk number must be numeric.'
  76.    exit
  77. end
  78.  
  79. /* Lets make sure its worth starting... */
  80. IF startval > endval then
  81. do
  82.    SAY 'Start disk number must be less than end disk number!'
  83.    exit
  84. end
  85.  
  86. SAY 'Getting FF disks' startval 'to' endval'...'
  87.  
  88. 'SET TIMEOUT' TIMEOUT
  89.  
  90. /* Get into ftp */
  91. SAY 'Starting ftp...'
  92. 'COMMAND' 'if ( ! -d' WHEREDIR ') mkdir' WHEREDIR'\r'
  93. 'WAITSTRING' USERPROMPT
  94. 'COMMAND' 'cd' WHEREDIR'\r'
  95. 'WAITSTRING' USERPROMPT
  96. 'COMMAND' 'ftp\r'
  97. 'WAITSTRING ftp>'
  98.  
  99. /* Connect to host */
  100. SAY 'Connecting...'
  101. 'COMMAND' 'open' FTPSITE'\r'
  102. 'WAITSTRING name'
  103. 'COMMAND' 'anonymous\r'
  104. 'WAITSTRING pass'
  105. 'COMMAND' ANONPWD'\r'
  106. 'WAITSTRING ftp>'
  107.  
  108. /* Set mode */
  109. SAY 'Setting up ftp...'
  110. 'COMMAND' 'bin\r'
  111. 'WAITSTRING ftp>'
  112. 'COMMAND' 'prompt\r'
  113. 'WAITSTRING ftp>'
  114. 'COMMAND' 'hash\r'
  115. 'WAITSTRING ftp>'
  116.  
  117. /* Get the contents files */
  118. SAY 'Getting contents files...'
  119. 'COMMAND' 'cd' DOCDIR'\r'
  120. 'WAITSTRING ftp>'
  121.  
  122. do dnum=startval to endval
  123.    SAY '   Getting Contents.' || dnum || '...'
  124.    ddir='f' || TRUNC(dnum/100)
  125.    'COMMAND' 'cd' ddir '\r'
  126.    'WAITSTRING ftp>'
  127.    'COMMAND' 'get Contents.' || dnum '\r'
  128.    'WAITSTRING ftp>'
  129.    'COMMAND' 'cd ..\r'
  130.    'WAITSTRING ftp>'
  131. end
  132.  
  133. /* Get the directories */
  134. SAY 'Getting FF disks by dir...'
  135. 'COMMAND' 'cd' DISKDIR'\r'
  136. 'WAITSTRING ftp>'
  137.  
  138. do dnum=startval to endval
  139.    ddir='f' || TRUNC(dnum/100)
  140.    dname='ff' || dnum
  141.  
  142.    SAY '   Getting' dname'...'
  143.    'COMMAND' 'cd' ddir '\r'
  144.    'WAITSTRING ftp>'
  145.  
  146.    'COMMAND' '!mkdir 'dname'\r'
  147.    'WAITSTRING ftp>'
  148.    'COMMAND' 'lcd 'dname'\r'
  149.    'WAITSTRING ftp>'
  150.    'COMMAND' 'cd 'dname'\r'
  151.    'WAITSTRING ftp>'
  152.    'COMMAND' 'mget *\r'
  153.    'WAITSTRING ftp>'
  154.    'COMMAND' 'cd ../..\r'
  155.    'WAITSTRING ftp>'
  156.    'COMMAND' 'lcd ..\r'
  157.    'WAITSTRING ftp>'
  158. end
  159.  
  160. /* All done finish up */
  161. SAY 'All done... quitting ftp.'
  162. 'COMMAND ' 'close\r'
  163. 'WAITSTRING ftp>'
  164. 'COMMAND' 'quit\r'
  165. 'WAITSTRING' USERPROMPT
  166.  
  167. /* Create an LHA archive
  168. SAY 'Archiving the directories...'
  169. 'COMMAND' 'lha c fishes' || startval || '-' || endval || '.lzh'
  170. do dnum=startval to endval
  171.    'COMMAND' ' ff' || dnum
  172. end
  173. 'COMMAND' '\r'
  174. 'WAITSTRING' USERPROMPT
  175. */
  176.  
  177. SAY 'Macro exiting.'
  178.  
  179. exit
  180.