home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / dragen1.zip / append.cmd next >
OS/2 REXX Batch file  |  2000-02-12  |  2KB  |  79 lines

  1. /* append copyright 2000, Keith Cotroneo */
  2. echo off
  3. filesize=0
  4. killtest=1
  5. do while lines(append.var)
  6. szlocal=linein(append.var)
  7. vfile=linein(append.var)
  8. parse var szlocal fsize localfile porttype
  9. /*say fsize localfile vfile*/
  10. if left(localfile,1)="'" then
  11.         do
  12.         localtmp=left(localfile,(length(localfile)-1))
  13.         localtmp=right(localtmp,(length(localtmp)-1))
  14.         rc=sysfiledelete(localtmp)
  15.                 if rc \= 0 then
  16.                 say localtmp": ready for download"
  17.                 else
  18.                 say localtmp": deleted, file will be replaced"
  19.         end
  20.         else
  21.         do
  22.         rc=sysfiledelete(localfile)
  23.                 if rc \= 0 then
  24.                 say localfile": ready for download"
  25.                 else
  26.                 say localfile": deleted, file will be replaced"
  27.         end
  28. getstr= "get2 -a:"porttype" "vfile
  29. /*say getstr*/
  30. getstr
  31. /* check to see if get2 could not get the host*/
  32. /* if ktest is on the drive, abort */
  33. killtest=linein(ktest)
  34. rc=stream(ktest,'c','close')
  35. if killtest=0 then
  36. do
  37. rc=stream(append.var,'c','close')
  38. exit
  39. end
  40. filesize=0
  41. do while filesize < fsize
  42.         if left(localfile,1)="'" then
  43.                 do
  44.                 localf=left(localfile,(length(localfile)-1))
  45.                 localf=right(localf,(length(localf)-1))
  46.                 end
  47.                 else
  48.                 do
  49.                 localf=localfile
  50.                 end
  51.         say "localf is " localf
  52.         call SysFileTree localf, 'nfile', 'F'
  53.         if nfile.0=0 then
  54.                 do
  55.                 say "file not found"
  56.                 rc=stream(localf,'c','close')
  57.                 filesize=0
  58.                 end
  59.                 else
  60.                 do
  61.                 say nfile.1
  62.                 parse VAR nfile.1 date time filesize name
  63.                 say nfile.1"="filesize" file  = "fsize
  64.                 end
  65.         call syssleep 1
  66.         if filesize < fsize then
  67.                 do
  68.                 say "Restarting download to get the rest of the file...."
  69.                 getstr = "get2 -a:"porttype" "vfile
  70.                 /*say getstr*/
  71.                 getstr
  72.                 end
  73. end
  74. end
  75. filesize=0
  76. rc=stream(append.var,'c','close')
  77. getstr="echo 1 > lwin"
  78. getstr
  79.