home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / fidtun.zip / FidTun.cmd next >
OS/2 REXX Batch file  |  1997-01-05  |  3KB  |  169 lines

  1. /* ************************************* */
  2. /* Fidonet Internet Tunnel         */
  3. /*                       */
  4. /*  Ver 0.1b                 */
  5. /*                       */
  6. /*                       */
  7. /*         by    Alok Sinha     */
  8. /*                India         */
  9. /*                       */
  10. /*                       */
  11. /* ************************************* */
  12.  
  13.  
  14.  
  15. rc=RxFuncAdd("FtpLoadFuncs","rxFtp","FtpLoadFuncs")
  16. rc=FtpLoadFuncs()
  17.  
  18. /* ****** Must Configure these to meet your system ****** */
  19.  
  20.  
  21.  
  22. /* Number of files you want to keep on the remote host spool */
  23. xnum=20
  24.  
  25. /* ******* Remote Stuff ******* */
  26. /* Say "Enter the Host name : " */
  27. xhostname="200.200.200.2"
  28.  
  29. /* Say "Enter User ID : " */
  30. xuser="anonymous"
  31.  
  32. /* Say "Enter Password : " */
  33. xpassword = "a@b.com"
  34.  
  35. /* Remote Node Address */
  36. xremotenode="17"
  37.  
  38.  
  39. /* My stuff */
  40. /* Local Node Address */
  41. xmynode="08"
  42.  
  43. /* inspool */
  44. xindir="i:\fidonet\files\inbound"
  45.  
  46. /* ooutspool */
  47. xoutdir="i:\fidonet\files\outbound"
  48.  
  49. /* "Remote Directory on the remote host " */
  50. xremdir= "/e/upload/017"
  51.  
  52. /* my recv mail directory on the remote host */
  53. xrecvdir="/e/upload/008"
  54.  
  55. /* ***** Configuration Ends --- ****** */
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. /*  STOP NO MORE USER DEFINABLE VARIABLE BELOW THIS POINT */
  75.  
  76. /*  Setup the basics */
  77.  
  78.  
  79. rc=FtpSetUser(xhostname, xuser, xpassword)
  80. rc=FtpSetBinary("Binary")
  81. rc=FtpChDir(xremdir)
  82.  
  83. /* send first */
  84.  
  85. xsendname="025e00"d2x(xremotenode)
  86.  
  87. /* now make a name for the files originating from this host */
  88.  
  89. xfname="fid"right(d2x(xmynode),3,0)
  90.  
  91.  
  92. /* checking if the file on the rmeote machine exists, if yes, rename
  93.    it to something old */
  94.  
  95. n=xnum
  96. do while n>0
  97.     cur=n
  98.     prev=n-1
  99.     xcur=right(cur,3,'0')
  100.     xprev=right(prev,3,'0')
  101.     rc=FtpRename(xfname"."xprev, xfname"."xcur)
  102.     n=n-1
  103. end 
  104.  
  105. /* delete previous copies of compressed output */
  106. say 
  107. "@echo off"
  108. say
  109. "@del "xfname".zip > null"
  110.  
  111. /* compress new files, and name it fidtun.zip */
  112. say 
  113. "@zip " xfname  xoutdir"\"xsendname".* > null"
  114.  
  115. /* now put the compressed file on the remote host */
  116. rc=FtpPutUnique(xfname".zip", xfname".001")
  117.  
  118. /* delete previous copies of compressed output */
  119. say
  120. "@del "xfname".zip"
  121.  
  122.  
  123. /* That's It !!!  files have been sent */ 
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. /* ----------------------------    */ 
  137.  
  138. /* Now lets get the files..... */
  139.  
  140. rc=FtpChDir(xrecvdir)
  141.  
  142. /* xfname=xindir"\fid"right(xmynode,3,0) */
  143.  
  144. rc=FtpLs("fid*","files.")
  145.  
  146.  
  147. n=files.0
  148. do while n>0
  149.     rc=FtpGet(xindir"\"files.n,files.n) 
  150.     if rc=-1 then say "Error "FTPERRNO
  151.     else rc=FtpDelete(files.n)
  152.     n=n-1
  153. end 
  154.  
  155.  
  156.  
  157.  
  158. say
  159. left(xindir,3)
  160. say
  161. "cd "right(xindir,length(xindir)-3)
  162. "unzip -oj  fid*"
  163.  
  164. "del fid0*.*"
  165.  
  166. /* enough, go back home !! */
  167. rc=FtpLogoff()
  168. rc=FtpDropFuncs()
  169.