home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / dumpgrp.zip / dumpall.cmd < prev    next >
OS/2 REXX Batch file  |  1993-09-07  |  6KB  |  130 lines

  1. /* This happy script autoextracts binaries from a number of newsgroups. */
  2.  
  3. /* Note that it requires John Steven's UNPOST utility. Source is widely */
  4. /* available (consult archie), and a compiled version is available via  */
  5. /* anonymous ftp from elvis.wicat.com (192.150.148.53)                  */
  6.  
  7. /* It makes several assumptions about directory structure; it is        */
  8. /* assumed that there is a single incoming directory on the current     */
  9. /* drive and that newsgroups are extraced to a series of                */
  10. /* sub-directories under that directory.                                */
  11. /* For instance, on my system, there is a c:\incoming directory, and    */
  12. /* comp.binaries.os2 is extracted to c:\incoming\cbos2.                 */
  13. /*                                                                      */
  14. /* To put this script to your own use:                                  */
  15. /*                                                                      */
  16. /*      1: Set the four user variables defined below in this file to    */
  17. /*         appropiate values. Make sure that any utilities you refrence */
  18. /*         (os2zip, for instance) are on your path, and that any        */
  19. /*         directories (\incoming, for instance) exist.                 */
  20. /*                                                                      */
  21. /*      2: Modify the supplied dumpgrp.cfg file to collect any groups   */
  22. /*         you want and place them in an appropiate sub-directory of    */
  23. /*         the INCOMING directory. Note that if you do not want to      */
  24. /*         modify this script more than necessary, DumpGrp must write   */
  25. /*         each group to a file with the same name as the sub-directory */
  26. /*         and with the .UUE extension. For instance, on my system,     */
  27. /*         DumpGrp writes comp.binaries.os2 to \incoming\cbos2\cbos2.uue*/
  28. /*         Also create these sub-directories.                           */
  29. /*                                                                      */
  30. /*      3: For each sub-directory you created, add a call to the        */
  31. /*         unpostit function after the "extract binaries" comment below.*/
  32. /*                                                                      */
  33. /*      4: If you are not using 4OS/2 or wish to keep zero-length files,*/
  34. /*         remove the calls to the delemptyfiles function. Otherwise,   */
  35. /*         add calls to delemptyfiles for any sub-directories you wish. */
  36. /*                                                                      */
  37. /*      5: Make sure that DUMPGRP.EXE, EXPIRE.EXE, and UNPOST.EXE are   */
  38. /*         all on your path.                                            */
  39. /*                                                                      */
  40. /*      6: Place your modified version of this file and DUMPGRP.CFG in  */
  41. /*         your INCOMING directory.                                     */
  42. /*                                                                      */
  43. /* Now start the script and watch the fun.                              */
  44.  
  45. /* Copyright 1993 Kevin Vigor.                                          */
  46.  
  47. /* User variables. */
  48.  
  49. /* This variable defines the line used to separate messages in the dump */
  50. /* files. If it ever appears in a message, ugly things will result.     */
  51. SEPARATOR = '***Kevins-Unique-Line-Separator-I-Hope***'
  52.  
  53. /* This variable defines the incoming directory. This is assumed to be  */
  54. /* on the current drive and should *not* include a drive letter.        */
  55. INCOMING = '\incoming'
  56.  
  57. /* The command line to compress a file.                                 */
  58. /* You can plug in your own utility here. (LHA, ZOO, etc.)              */
  59. COMPRESS = 'os2zip'
  60.  
  61. /* The command line to decompress a file from an archive.               */
  62. UNCOMPRESS = 'os2unzip -o'
  63.  
  64. /* The extension produced by the compressor utility.                    */
  65. COMPRESSEDEXT = '.ZIP'
  66.  
  67. /* User variables end. */
  68.  
  69. /* Add the SysSleep function. */
  70. call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
  71.  
  72. /* The endless loop. */
  73. make_run:
  74.  
  75. /* Dump newsgroups. */
  76. "\dumpgrp\dumpgrp -swicat -r -l"SEPARATOR
  77.  
  78. /* Extract binaries. */
  79. call unpostit "abpm"
  80. call unpostit "cbos2"
  81.  
  82. /* Delete empty files. */
  83. call delemptyfiles "abpm"
  84.  
  85. "cd "INCOMING
  86.  
  87. say 'Going to sleep @ 'TIME()
  88. /* Sleep for an hour. */
  89. call SysSleep 3600
  90.  
  91. /* Loop forever. */
  92. signal make_run
  93.  
  94. /* FUnction to extract binaries for a sub-directory. */
  95. unpostit:
  96. "cd "INCOMING"\"ARG(1)
  97.  
  98. /* Extract any incomplete messages from the archive */
  99. UNCOMPRESS "incomp"COMPRESSEDEXT
  100.  
  101. /* Unpost the latest batch, saving the incomplete messages to INCOMP.UUE */
  102. "unpost -i incomp.uue -rg" ARG(1)".uue"
  103. "del "ARG(1)".uue"
  104.  
  105. /* Unpost the incompletes, hoping some are now complete. The still-incomplete */
  106. /* messages are saved to incomp2.uue */
  107. "unpost -i incomp2.uue -rg incomp.uue"
  108. "del incomp.uue"
  109.  
  110. /* Delete any remaining incomplete messages older than 5 days. The output */
  111. /* is saved to incomp.uue */
  112. "expire -d -l"SEPARATOR" incomp2.uue incomp.uue"
  113. "del incomp2.uue"
  114.  
  115. /* zip up incomp.uue and my work here is done. */
  116. COMPRESS "incomp"COMPRESSEDEXT" incomp.uue"
  117. "del incomp.uue"
  118. return
  119.  
  120. jpegtogif:
  121. "cd "INCOMING"\"ARG(1)
  122. "call \jpeg\cvtall"
  123. return
  124.  
  125. delemptyfiles:
  126. /* This function requires 4OS/2. */
  127. "cd "INCOMING"\"ARG(1)
  128. "for %%a in (*.*) do if %@filesize[%%a,b] == 0 del %%a"
  129. return
  130.