home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / dwnsrt62.zip / SPLITSUM.CMD < prev    next >
OS/2 REXX Batch file  |  1995-10-02  |  1KB  |  54 lines

  1. /* ───────────────────────────────────────────────────────────────────── */
  2. /* Extract Summary from Downsort's ALLFileList    -    by Rob Hamerling  */
  3. /* ───────────────────────────────────────────────────────────────────── */
  4.  
  5. if RxFuncQuery('SysFileTree') = 1 then
  6.   call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
  7.  
  8. parse arg all sum
  9.  
  10. if all <> '' then
  11.   call SysFileTree all, 'file', 'FO'
  12. if all = '' | sum = '' | file.0 = 0 then
  13.   do
  14.     call beep 800, 200
  15.     say ''
  16.     say 'Syntax:  SPLITSUM  <allfiles>  <summary>'
  17.     say ''
  18.     say ' <allfiles> and <summary> should specify input and output files'
  19.     say ''
  20.     if file.0 = 0 then
  21.       say ' <allfiles>' all 'could not be found'
  22.     exit 1
  23.   end
  24.  
  25. say 'Extracting file area summary report of' file.1 'into' sum
  26.  
  27. linecount = 0
  28. do while lines(file.1) > 0              /* copy header */
  29.   l = linein(file.1)
  30.   linecount = linecount + 1
  31.   if substr(l, 1, 5) = '═════' & linecount < 100 then
  32.     leave
  33.   rx = lineout(sum, l)
  34. end
  35.  
  36. do while lines(file.1) > 0              /* skip to summary */
  37.   l = linein(file.1)
  38.   if substr(l, 1, 1) = ' ' then
  39.     leave
  40. end
  41.  
  42. if lines(file.1) = 0 then               /* check if summary present */
  43.   do
  44.     say 'No summary found in' file.1
  45.     exit 99
  46.   end
  47.  
  48. do while lines(file.1) > 0              /* rest of file is summary */
  49.   l = linein(file.1)
  50.   rx = lineout(sum, l)
  51. end
  52.  
  53. exit
  54.