home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / 123rexx.zip / REXXDISK.CMD < prev    next >
OS/2 REXX Batch file  |  1992-12-22  |  2KB  |  46 lines

  1. /*****************************************************************************/
  2. /* Lotus 1-2-3 For OS/2 sample @function.                                               */
  3. /*                                                                                                   */
  4. /* @REXX("REXXDISK.CMD","SPACE",disks..)                                     */
  5. /*                                                                                                   */
  6. /* Returns the most free space available among 'disks'.                      */
  7. /*                                                                                                   */
  8. /* This program isses the DIR command to determine how much space there is   */
  9. /* on each disk, and pipes the output to the REXX queue.  It then reads from */
  10. /* that queue to get the information.    If you run this under OS/2 2.0 there  */
  11. /* is probably a built-in function that could be used in its stead, and it   */
  12. /* is probably much faster.                                                                  */
  13. /*                                                                                                   */
  14. /* @REXX("REXXDISK.CMD logFileName","SPACE",disks..)                         */
  15. /*                                                                                                   */
  16. /* Writes any TRACE or SAY output to a log file named 'logFileName'.         */
  17. /*                                                                                                   */
  18. /* Copyright (c) 1991 Lotus Development Corporation.    This code is supplied  */
  19. /* on an 'as is' basis as an example only.  This code has only received      */
  20. /* informal testing by Lotus.  Permission is granted    to copy and modify      */
  21. /* this code to your heart's content.  No warrenties expressed or implied.   */
  22. /* Remember, your mileage may vary.  Let us know if you find support of REXX */
  23. /* by 1-2-3 useful.                                                                              */
  24. /*****************************************************************************/
  25. TRACE R
  26. ARG what,  drives
  27. say what
  28. say drives
  29. IF what = "?" THEN SIGNAL Tell    /* give info if called with "?" as 1st arg */
  30. numDrives = Words(drives)
  31. mostSpace = 0
  32. ADDRESS "CMD"                                     /* direct commands to OS/2 */
  33. DO i = 1 TO numDrives                                  /* loop to examine each drive */
  34.     drive = Word(drives, i)                                      /* get the next drive */
  35.     "DIR" drive"\" "| RXQUEUE"         /* fails if no files in root directory */
  36.     DO Queued() - 1; PULL .; END                                     /* get the results */
  37.     PULL space . .
  38.     IF space > mostSpace THEN mostSpace = space              /* most space so far */
  39.     END
  40. IF what = "SPACE" THEN RETURN mostSpace  /* some day return other info maybe */
  41. RETURN 0
  42.  
  43. Tell:                                                       /* return a brief description */
  44. RETURN '@REXX("REXXDISK.CMD","SPACE",disks..) ==> returns most free space',
  45.     "on one of 'disks'."
  46.