home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 28 Fixes4x / 28-Fixes4x.zip / updcd10.zip / HTM.ZIP / cdlist.cmd next >
OS/2 REXX Batch file  |  2000-11-13  |  1KB  |  59 lines

  1. /* List all files contained on a Warp CD in plain, packed or zipped files */
  2.  
  3. parse arg cddrive
  4. if cddrive = '' then 
  5.     do
  6.         say 
  7.         say 'Warp 4 CD-ROM lister.'
  8.         say 
  9.         say 'Missing required parameter!'
  10.         say
  11.         say 'Usage: cdlist.cmd <drive letter CD-ROM>'
  12.         say 'Example: cdlist h'
  13.         say 'Output: cdlist.txt'
  14.         exit
  15.     end
  16.  
  17. rc = RxFuncAdd('SysFileTree', 'RexxUtil', 'SysFileTree')
  18. say 'Reading CD-ROM...'
  19. rc = sysfiletree(cddrive':\*', 'file.', 'FSO')
  20. if rc <> 0 | file.0 = 0 then
  21.     do
  22.         say 'Drive 'cddrive': cannot be accessed or contains no CD!'
  23.         exit 9
  24.     end
  25.  
  26. vanunzip = 0
  27. '@unzip -? >nul 2>>&1' /* do you have unzip.exe? */
  28. if rc <> 10 then
  29.     do
  30.         say 'You do not have unzip.exe in your PATH-ban! Cannot list the contents of zip files.'
  31.         '@pause'
  32.     end
  33. else 
  34.     vanunzip = 1
  35.  
  36. outfile = 'cdlist.txt'
  37. '@del 'outfile' >nul 2>>&1'
  38. do i=1 to file.0
  39.     sor = file.i
  40.  
  41.     if length(sor) > 57 then
  42.         say 'Reading: ...'reverse(substr(reverse(sor), 1, 57))
  43.     else
  44.         say 'Reading: 'sor
  45.  
  46.     if translate(substr(sor, lastpos('.', sor)+1)) = 'ZIP' & vanunzip = 1 then
  47.         do
  48.             '@echo 'sor'        >> 'outfile' 2>nul'
  49.             '@unzip -Z2 'sor'     >> 'outfile' 2>nul'
  50.         end
  51.     else
  52.         '@unpack 'sor' /show         >> 'outfile' 2>nul'
  53. end
  54.  
  55. say
  56. say 'Ready. The file list can be found in 'outfile'.'
  57.  
  58. exit 
  59.