home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / dirs_12.zip / dirs.cmd next >
OS/2 REXX Batch file  |  1997-11-22  |  1KB  |  63 lines

  1. /*
  2.  *  dirs.cmd
  3.  *  Search for files
  4.  *  1995-03-28, Rolf Lochbuehler
  5.  */
  6.  
  7. call rxfuncadd 'sysfiletree', 'rexxutil', 'sysfiletree'
  8.  
  9. parse arg filename startdir
  10.  
  11. if filename = '' then 
  12.   do       
  13.   call help
  14.   exit 2
  15.   end
  16.  
  17. if translate(filename) = '-H' then 
  18.   do
  19.   call help
  20.   exit 1
  21.   end
  22.  
  23. if startdir <> '' then
  24.   do
  25.   currentdir = directory()
  26.   call directory startdir
  27.   end
  28.  
  29. call sysfiletree filename, 'filefound', 'fso'
  30. if filefound.0 > 0 then
  31.   do i = 1 to filefound.0
  32.     say filefound.i
  33.   end
  34. else
  35.   do
  36.   say 'No files found that match' filename'.'
  37.   exit 3
  38.   end
  39.  
  40. if symbol(currentdir) <> 'VAR' then
  41.   call directory currentdir
  42.  
  43. exit 0
  44.  
  45.  
  46. help : procedure
  47.   say ''
  48.   say 'dirs -- V1.2, 1997-11-22, Rolf Lochbuehler <rolobue@ibm.net>'
  49.   say 'Purpose:'
  50.   say '  Print all file names matching a file name or file name template.'
  51.   say 'Usage:'
  52.   say '  dirs FILE [DIR]'  
  53.   say 'Arguments:'
  54.   say '  FILE   Name of file(s) to search for'
  55.   say '  DIR    Directory in which to start the search'
  56.   say '         (default: current working directory)'
  57.   say 'Examples:'
  58.   say '  dirs *.cmd'
  59.   say '  dirs *.dll c:\'
  60.   return
  61.  
  62.  
  63.