home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / comm / mkdiff12.lha / MakeR25Diff.rexx < prev   
OS/2 REXX Batch file  |  1993-01-12  |  3KB  |  93 lines

  1. /* MakeR25Diff.rexx v1.0 (12 Jan 1993)
  2.  *
  3.  * A small example add-on to the makediff utility to automatically
  4.  * make diff files for Region 25 Nodelists and export them
  5.  *
  6.  * usage: RX MakeR25Diff
  7.  *
  8.  * note that you need to unpack the archive to the correct directory
  9.  * before running the program.
  10.  *
  11.  * written by: Iain Hibbert @ 2:255/35.13
  12.  *             Tony Jones @ 2:255/35
  13.  */
  14.  
  15. /* customise this bit */
  16. Dir = "T:"                  /* where to find and put the files */
  17. Nodelist = "Region25"       /* nodelist file stem to use */
  18. DiffName = "R25Diff"        /* diff file stem to use */
  19.  
  20. olddir = pragma('D',Dir)
  21.  
  22. /* find the most recent nodelist numbers.. */
  23. files = showdir("",,'0A'x)
  24. latest = 0
  25. number = 0
  26.  
  27. do while files ~= ""
  28.     parse var files file '0A'x files
  29.     parse var file head '.' tail
  30.     if upper(Nodelist) == upper(head) then do
  31.         parse value statef(file) with . . . . day . . .
  32.         if day > latest then do
  33.             number = tail
  34.             latest = day
  35.         end
  36.     end
  37. end
  38.  
  39. if number = 0 then do
  40.     say 'Sorry, no 'Nodelist' files found in 'Dir
  41. end
  42. else do
  43.     Archive = DiffName || '.' || 'L' || right(number,2,'0')
  44.     DiffName = DiffName || '.' || right(number,3,'0')
  45.  
  46.     say 'Latest 'Nodelist' nodelist is 'number
  47.  
  48.     if exists(DiffName) then say DiffName' already exists.'
  49.     else do
  50.         /* find last weeks nodelist file */
  51.         last = number - 7
  52.         if last < 0 then do
  53.             last = last + 365
  54.             if ~exists(Nodelist||'.'||right(last,3,'0')) then last=last+1
  55.         end
  56.  
  57.         OldList = Nodelist || '.' || right(last,3,'0')
  58.         Nodelist = Nodelist || '.' || right(number,3,'0')
  59.  
  60.         if ~exists(OldList) then say 'No 'OldList' to diff from.'
  61.         else do
  62.             writech(stdout, 'Making 'DiffName' .... ' )
  63.             address command 'makediff 'OldList Nodelist DiffName
  64.             say 'Done.'
  65.  
  66.             /*
  67.              * after this, you can do whatever you want with the
  68.              * Diff file, it will be called DiffName in the Dir
  69.              * Directory.. the full file and pathname is:
  70.              *
  71.              *          Dir || DiffName
  72.              */
  73.  
  74.             address command 'LhA a 'Archive DiffName
  75.  
  76.             /*
  77.              * and now its called Dir || Archive
  78.              */
  79.  
  80.             /* you can upload it to the board automatically */
  81.             address command 'DLGProgs:DLGUpload -f '||Archive||' -a 20 -u MakeDiff -d "Region 25 NodeDiff for Day Number '||number
  82.  
  83.             /* or you can send it out to the points that want it.. */
  84.             address command 'Fido:SendFile -OOut: -N2:255/35.10 -H '||Dir||Archive
  85.             address command 'Fido:SendFile -OOut: -N2:255/35.13 -H '||Dir||Archive
  86.         end
  87.     end
  88. end
  89.  
  90. call pragma('D',olddir)
  91.  
  92. exit
  93.