home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / comm / mkdiff12.lha / makeall.rexx next >
OS/2 REXX Batch file  |  1993-01-01  |  3KB  |  87 lines

  1. /* Makediff.rexx v1.0 (28 Dec 1992)
  2.  *
  3.  * A small add-on to the makediff utility to automatically make diff
  4.  * files for multiple networks.
  5.  *
  6.  * usage: rx makediff
  7.  *
  8.  * written by Iain Hibbert @ 2:255/35.13
  9.  */
  10.  
  11. Dir = "Nodelist:"   /* where to find and put the files */
  12.  
  13. /* you can have as many networks as you like */
  14. networks = 2
  15.  
  16. /* first network nodelist to search for */
  17. Nodelist.1 = "Region25"
  18. DiffName.1 = "R25Diff"
  19. latest.1 = 0
  20.  
  21. /* second network nodelist to search for */
  22. Nodelist.2 = "Amylist"
  23. DiffName.2 = "AmyDiff"
  24. latest.2 = 0
  25.  
  26. /* find the most recent nodelist numbers.. */
  27. files = showdir(Dir,,'0A'x)
  28.  
  29. do while files ~= ""
  30.     parse var files file '0A'x files
  31.     parse var file head '.' tail
  32.     do i = 1 to networks
  33.         if upper(Nodelist.i) == upper(head) then do
  34.             parse value statef(Dir||file) with . . . . day . . .
  35.             if day > latest.i then do
  36.                 number.i = tail
  37.                 latest.i = day
  38.             end
  39.         end
  40.     end i
  41. end
  42.  
  43. do i = 1 to networks
  44.     say 'Latest 'Nodelist.i' nodelist is 'number.i
  45.     DiffName.i = DiffName.i || '.' || right(number.i,3,'0')
  46.     if exists(Dir||DiffName.i) then say DiffName.i' already exists.'
  47.     else do
  48.         /* find last weeks nodelist file */
  49.         tail = number.i - 7
  50.         if tail < 0 then do
  51.             tail = tail + 365
  52.             if ~exists(Dir||Nodelist.i||'.'||right(tail,3,'0')) then tail = tail + 1
  53.         end
  54.         OldList = Nodelist.i || '.' || right(tail,3,'0')
  55.         Nodelist.i = Nodelist.i || '.' || right(number.i,3,'0')
  56.  
  57.         if ~exists(Dir||OldList) then say 'No 'OldList' to diff from.'
  58.         else do
  59.             writech(stdout, 'Making 'DiffName.i' .... ' )
  60.             address command 'makediff 'Dir||OldList Dir||Nodelist.i Dir||DiffName.i
  61.             say 'Done.'
  62.  
  63.             /*
  64.              * after this, you can do whatever you want with the
  65.              * Diff file, it will be called DiffName.i in the Dir
  66.              * Directory.. the full file and pathname is:
  67.              *
  68.              *          Dir || DiffName.i
  69.              *
  70.              * either you can upload it to the board automatically
  71.              * or you can send it out to the points that want it..
  72.              *
  73.              *  note that this will be done for each network in the
  74.              * list, that a diff has been made for, so I suggest a
  75.              * different script file which you would write specifically
  76.              * for your own situation (hey, I never said it would be
  77.              * easy! ) eg
  78.              *
  79.              *  address command 'SendDiff 'Dir||DiffName.i
  80.              */
  81.  
  82.         end
  83.     end
  84. end i
  85.  
  86. exit
  87.