home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d134 / find.lha / Find / find.doc < prev    next >
Text File  |  1988-03-18  |  4KB  |  113 lines

  1. Documentation for Amiga find utility
  2. ------------------------------------
  3.  
  4.     Usage:    find <path name list> <boolean expression>
  5.  
  6.     Find is a utility which searches for files  that  satisfy  a  given
  7.     boolean expression. The files are sought starting from path name(s)
  8.     from a given list and searching is done  recursively  down  through
  9.     the hierachy of the file system. The boolean expression is  written
  10.     using the following directives:
  11.  
  12.     -print
  13.     
  14.         - this directive simply displays the  full  path  name  of  the
  15.           current file and always returns true.
  16.  
  17.     -name <file-name>
  18.  
  19.         - the name of the current file being examined is compared with
  20.           <file-name> and if a match occurs then true is returned. The
  21.           wildcards * and ? may used in the name but will need  to  be
  22.           escaped if your command  line  interpreter  processes  these
  23.           characters. NB: the wildcards # and  ?  are  NOT  supported.
  24.  
  25.     -type [df]
  26.     
  27.         - this directive compares the type of the  current  file  with
  28.           the type specified which is either 'd' for directory or  'f'
  29.           for ordinary file. If a match occurs then true is returned.
  30.  
  31.     -size n[c]
  32.  
  33.         - this directive succeeds if the size of the current file is n
  34.           blocks. If n is followed by the character 'c', the  size  in
  35.           characters (bytes) is checked.
  36.  
  37.     -exec cmd
  38.     
  39.         - this directive executes the string 'cmd' and is true provided
  40.           this command can be executed and returns a zero value for  an
  41.           exit code. The end of 'cmd' must be punctuated by a semicolon
  42.           and this semicolon will have to be escaped if interpreted  by
  43.           whatever command line interpreter you are using.  An argument
  44.           of {} in cmd is replaced by the full path name of the current
  45.           file.
  46.  
  47.     -ok cmd
  48.     
  49.         - 'ok' is the same as  the  -exec  directive  except  that  the
  50.           command to be executed (with {} expanded)  is  first  printed
  51.           followed  by  a  question  mark.  Execution  of  the  command
  52.           proceeds only if the user enters a 'y' (or 'Y'). If any other
  53.           response is given,  the  command  is  not  executed  and  the
  54.           directive fails.
  55.  
  56.     -newer file
  57.     
  58.         - the date stamp on the current file is compared with  that  of
  59.           the given file and true is returned if the  current  file  is
  60.           newer than the given file.
  61.  
  62.     -mtime n
  63.  
  64.         - succeeds if the modification time of the current  file  is  n
  65.           days from the current time.
  66.  
  67.     -perm string
  68.  
  69.         - succeeds if the current file has  the  permissions  that  are
  70.           specified by the given string. Permissible characters in  the
  71.           string are 'r', 'w', 'e', 'd', in any order  or  'n'  for  no
  72.           permission. Note: these are permissions as listed by 'dir' or
  73.           'list' and not the protection specifications as stored by the
  74.           operating system.
  75.  
  76.     ( expression )
  77.     
  78.         - is true if the boolean expression within the  parentheses  is
  79.           true.
  80.  
  81.     In the above descriptions, the  number  'n'  refers  to  a  decimal
  82.     integer and can be written as:
  83.  
  84.         +n - which means greater than n;
  85.         -n - which means less    than n; or
  86.          n - which means exactly n.
  87.  
  88.     Combination of the boolean directives above can be done  using  the
  89.     following operators (in order of decreasing precedence):
  90.  
  91.         a)  '!' - unary NOT operator.
  92.         b)  and - this operation is  implicit  (i.e. no operator);  the
  93.                   directives are simply concatenated together.
  94.         c)  -o  - 'or' operator.
  95.  
  96. Examples
  97. --------
  98.  
  99.     - to list all files on the internal drive:
  100.  
  101.         find df0: -print
  102.  
  103.     - to remove all editor backup files that are more than two weeks old
  104.       from a system with two hard disks (name depends on editor):
  105.  
  106.         find dh0: dh1: -name *.bak -mtime +14 -exec delete {} ;
  107.  
  108.     - to list all source and header files in a source directory:
  109.  
  110.         find :src ( -name *.c -o -name *.h ) -print
  111.  
  112.     NB: Don't forget to escape * and ; if necessary.
  113.