home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / fm2utils.zip / sweep.cmd < prev    next >
OS/2 REXX Batch file  |  1998-05-25  |  1KB  |  52 lines

  1. /*
  2.  * A sweep command for OS/2
  3.  * Recurses through directories from default and executes a command line
  4.  * Freeware by M. Kimes
  5.  */
  6.  
  7. '@echo off'
  8. parse arg cl
  9. if cl = '/?' then signal givehelp
  10. if cl = '?' then signal givehelp
  11. if cl = '-?' then signal givehelp
  12. if cl = '' then signal givehelp
  13. n = setlocal()
  14. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  15. call SysLoadFuncs
  16. dummy = charout(,'Working...')
  17. rc = SysFileTree('*',filename,'DS')
  18. dummy = charout(,'0d'x)
  19. dummy = charout('          ')
  20. dummy = charout('0d'x)
  21. if rc = 0 then
  22. do
  23.   do i = 1 to filename.0
  24.     parse var filename.i fdate ftime fsize fattr fname
  25.     fname = strip(fname,'b')
  26.     newdir = directory(fname)
  27.     if newdir = fname then
  28.     do
  29.       if cl \= '' then
  30.       do
  31.         say '['fname']: 'cl
  32.         cl
  33.       end
  34.     end
  35.   end
  36. end
  37. n = endlocal()
  38. exit
  39.  
  40. givehelp:
  41. say 'SWEEP.CMD'
  42. say ' Performs a command in all subdirectories of the current directory.'
  43. say ''
  44. say ' Usage:    Sweep command'
  45. say ''
  46. say ' Examples: Sweep DEL *.BAK'
  47. say '           Sweep COPY *.TXT D:\BACKUP'
  48. say '           Sweep FOR %D in (*.MAK) DO NMAKE /A /F %D'
  49. say ''
  50. say 'Hector wuz here.'
  51. exit
  52.