ffiinndd -- Command

Search for files satisfying a pattern
ffiinndd _d_i_r_e_c_t_o_r_y ... [_e_x_p_r_e_s_s_i_o_n ...]

ffiinndd  traverses each  given _d_i_r_e_c_t_o_r_y,  testing  each file  or subdirectory
found with  the _e_x_p_r_e_s_s_i_o_n part of  the command line.  The  test can be the
basis for deciding whether to process the file with a given command.

If the  command line specifies  no _e_x_p_r_e_s_s_i_o_n or specifies  no execution or
printing (-pprriinntt,  -eexxeecc, or -ookk), by default ffiinndd  prints the pathnames of
the files found.

In the  following, _f_i_l_e means  any file: directory,  special file, ordinary
file, and so on.  Numbers represented  by _n may be optionally prefixed by a
`+'  or  `-'  sign  to signify  values  greater  than  _n  or less  than  _n,
respectively.

ffiinndd recognizes the following _e_x_p_r_e_s_s_i_o_n primitives:

-aattiimmee _n
        Match if the file was accessed in the last _n days.

-ccttiimmee _n
        Match if the  i-node associated  with the file  was changed  in the
        last _n days, as by cchhmmoodd.

-eexxeecc _c_o_m_m_a_n_d
        Match if _c_o_m_m_a_n_d  executes successfully  (has a zero  exit status).
        The _c_o_m_m_a_n_d consists of the following arguments to ffiinndd, terminated
        by  a  semicolon  `;'  (escaped  to  get  past  the  shell).   ffiinndd
        substitutes the current  pathname being tested for  any argument of
        the form `{}'.

-ggrroouupp _n_a_m_e
        Match if the file is owned by group  _n_a_m_e. If _n_a_m_e is a number, the
        owner must have that group number.

-iinnuumm _n
        Match if the file is associated with i-number _n.

-lliinnkkss _n
        Match if the number of links to the file is _n.

-mmttiimmee _n
        Match if the most recent modification to the file was _n days ago.

-nnaammee _p_a_t_t_e_r_n
        Match if the  file name corresponds  to _p_a_t_t_e_r_n, which  may include
        the special  characters  `*', `?',  and `[...]'  recognized by  the
        shell sshh. The _p_a_t_t_e_r_n matches only  the part of the file name after
        any slash (`/') characters.

-nneewweerr _f_i_l_e
        Match if the file is newer than _f_i_l_e.

-nnoopp    Always match; does nothing.

-ookk _c_o_m_m_a_n_d
        Same as -eexxeecc above, except prompt  interactively and only executes
        _c_o_m_m_a_n_d if the user types response `yy'.

-ppeerrmm _o_c_t_a_l
        Match if owner,  group, and other  permissions of the  file are the
        _o_c_t_a_l bit pattern, as described in  cchhmmoodd. When _o_c_t_a_l begins with a
        `-' character,  more of  the permission  bits (setuid,  setgid, and
        sticky bit) become significant.

-pprriinntt  Always match; print the file name.

-ssiizzee _n
        Match if the file is _n blocks in length; a block is 512 bytes long.

-ttyyppee _c
        Match if the type of the file is _c, chosen from the set bbccddffmmpp (for
        block  special,  character   special,  directory,   ordinary  file,
        multiplexed file, or pipe, respectively).

-uusseerr _n_a_m_e
        Match if the file is  owned by user _n_a_m_e. If _n_a_m_e  is a number, the
        owner must have that user number.

_e_x_p_1 _e_x_p_2
        Match if both expressions match.  ffiinndd  evaluates _e_x_p_2 only if _e_x_p_1
        matches.

_e_x_p_1 -aa _e_x_p_2
        Match if both expressions match, as above.

_e_x_p_1 -oo _e_x_p_2
        Match if either  expression matches.   ffiinndd evaluates eexxpp22  only if
        eexxpp11 does not match.

! _e_x_p   Match if the expression does _n_o_t match.

( _e_x_p )
        Parentheses are available for expression grouping.

_E_x_a_m_p_l_e_s
A ffiinndd  command to  print the  names of all  files and directories  in user
ffrreedd's directory is:

    find /usr/fred

The following, more complicated  ffiinndd command prints out information on all
ccoorree and object  (.oo) files that have not been  changed for a day.  Because
some characters are special both to  ffiinndd and sshh, they must be escaped with
`\' to avoid interpretation by the shell.

    find / \( -name core -o -name \*.o \) -mtime +1 \
    -exec ls -l {} \;

Finally, the  following example implements a simple  tool for keeping files
on two COHERENT systems in synch with each other.  ffiinndd reads directory ssrrcc
and  passes  to uuuuccpp  the  names of  all  files that  are  newer than  file
llaasstt_uuppllooaadd.  It  then  uses  the  command  ttoouucchh to  update  the  date  on
llaasstt_uuppllooaadd, to use it as a marker of when the last upload was performed.

find $HOME/src -type f -newer last_upload | while read filename
do
    uucp -r -nyou $filename yoursystem!~/
    echo Queued file $filename to yoursystem ...
done | mail somebodyorother
touch last_upload

_S_e_e _A_l_s_o
cchhmmoodd, ccoommmmaannddss, llss, sshh, ssrrccppaatthh, tteesstt
