home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / newzips.zip / NEWZIPS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-06-25  |  2KB  |  69 lines

  1. /* newzips  -   Felix Sawicki  */ 
  2. /* trace ?r */
  3. /******************************************************************
  4. Change the next two lines to set default directories
  5. *******************************************************************/
  6. defaultdown = 'e:\download'
  7. defaultdest = 'f:\tools'
  8. /******************************************************************/
  9. arg downdirect destdirect  .
  10. if downdirect = '' then downdirect = defaultdown
  11. if destdirect = '' then destdirect = defaultdest
  12. if downdirect = '.' then downdirect = directory()
  13. downdrive = left(downdirect,1)
  14. destdrive = left(destdirect,1)
  15. if (right(downdirect,1) <> '\') then downdirect = downdirect'\'
  16. if (right(destdirect,1) <> '\') then destdirect = destdirect'\'
  17. Call RxFuncAdd 'SysSetObjectData', 'RexxUtil', 'SysSetObjectData'
  18. /* pull anything already in the queue */
  19. numb = queued()
  20. do i = 1 to numb 
  21. pull .
  22. end
  23.  
  24. 'dir 'downdirect||'*.* /b | rxqueue'   /* get list of  files */
  25. i=0
  26. numb = queued()
  27. do j = 1 to numb
  28. parse upper pull name '.' type .
  29. select
  30.   when type = 'ZIP'
  31.      then do
  32.      destdrive':'     /* switch to destination drive */
  33.      newdirect = destdirect||name
  34.      'md 'newdirect
  35.      'cd ' newdirect
  36. /**************************************************************
  37. Change the next line to use the right unzip routine
  38. ***************************************************************/
  39.      'unzip -o ' downdirect||name
  40.      if rc = 0 then 
  41.         do
  42.         'erase 'downdirect||name||'.piz'
  43.         'rename 'downdirect||name||'.zip' name||'.piz'
  44.         Call SysSetObjectData newdirect, 'OPEN=DEFAULT' 
  45.         end
  46.      end   
  47. when type = 'LZH'
  48.      then do
  49.      destdrive':'     /* switch to destination drive */
  50.      newdirect = destdirect||name
  51.      'md 'newdirect
  52.      'cd ' newdirect
  53. /*************************************************************
  54. Change the next line to use the right LHZ unarchiver
  55. *************************************************************/
  56.      'LH32 X /o' downdirect||name
  57.      if rc = 0 then 
  58.         do
  59.         'erase 'downdirect||name||'.hzl'
  60.         'rename 'downdirect||name||'.lzh' name||'.hzl'
  61.         Call SysSetObjectData newdirect, 'OPEN=DEFAULT' 
  62.         end
  63.      end   
  64.   otherwise 
  65.  
  66. end
  67.  end
  68. Call SysSetObjectData LEFT(DOWNDIRECT,LENGTH(downdirect)-1) , 'OPEN=DEFAULT'
  69.