home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / SAAREXX.ZIP / TRYIT.CMD < prev    next >
OS/2 REXX Batch file  |  1991-08-03  |  3KB  |  69 lines

  1. /*-- REXX ------------------------------------------------------------*/
  2. /*                                                                    */
  3. /* Module Name: TRYIT.CMD                                             */
  4. /*                                                                    */
  5. /* Function:    REXX exec example for XMPMAIN.EXE.                    */
  6. /*                                                                    */
  7. /* Author:      W. David Ashley                                       */
  8. /*                                                                    */
  9. /* Date:        02 August 1991                                        */
  10. /*                                                                    */
  11. /* (C) W. David Ashley 1991                                           */
  12. /*                                                                    */
  13. /* Modifications:                                                     */
  14. /* --------  ---  --------------------------------------------------- */
  15. /* 08/02/91  WDA  Initial Release                                     */
  16. /*                                                                    */
  17. /*--------------------------------------------------------------------*/
  18.  
  19. if arg() <> 1 then do
  20.    say 'Invalid input argument.'
  21.    exit 4
  22.    end
  23.  
  24. arg file
  25.  
  26. /* the following will load the external function if this REXX cmd     */
  27. /* is running standalone (not invoked from XMPMAIN.EXE)               */
  28. if rxfuncquery('RexDir') then do
  29.    call rxfuncadd 'RexDir','XMPFXDLL','REXDIR'
  30.    dropextfunc = 1
  31.    end
  32. else do /* we're running under XMPMAIN.EXE */
  33.    dropextfunc = 0
  34.    end
  35.  
  36. call delentries '.'
  37.  
  38. if dropextfunc = 1 then call rxfuncdrop 'RexDir'
  39.  
  40. exit 0
  41.  
  42. /*--------------------------------------------------------------------*/
  43. /*                                                                    */
  44. /*  delentries                                                        */
  45. /*                                                                    */
  46. /*      Delete file from current and lower subdirectories.            */
  47. /*                                                                    */
  48. /*--------------------------------------------------------------------*/
  49.  
  50. delentries: procedure expose file
  51. arg fspec
  52.  
  53. /* get directory listing of the current directory */
  54. retc = RexDir(fspec || '\*.*', 'line', 'B')
  55. if retc <> 0 | line.0 = 0 then do
  56.    say 'Error reading directory' fspec
  57.    exit
  58.    end
  59.  
  60. do i = 1 to line.0
  61.    if pos('<DIR>', line.i) > 0 & substr(line.i, 39, 1) <> '.' then do
  62.       call delentries fspec || '\' || substr(line.i, 39)
  63.       end
  64.    end
  65. 'del' fspec || '\' || file
  66.  
  67. return
  68.  
  69.