home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d134
/
find
/
find.doc
< prev
next >
Wrap
Text File
|
1988-03-18
|
4KB
|
113 lines
Documentation for Amiga find utility
------------------------------------
Usage: find <path name list> <boolean expression>
Find is a utility which searches for files that satisfy a given
boolean expression. The files are sought starting from path name(s)
from a given list and searching is done recursively down through
the hierachy of the file system. The boolean expression is written
using the following directives:
-print
- this directive simply displays the full path name of the
current file and always returns true.
-name <file-name>
- the name of the current file being examined is compared with
<file-name> and if a match occurs then true is returned. The
wildcards * and ? may used in the name but will need to be
escaped if your command line interpreter processes these
characters. NB: the wildcards # and ? are NOT supported.
-type [df]
- this directive compares the type of the current file with
the type specified which is either 'd' for directory or 'f'
for ordinary file. If a match occurs then true is returned.
-size n[c]
- this directive succeeds if the size of the current file is n
blocks. If n is followed by the character 'c', the size in
characters (bytes) is checked.
-exec cmd
- this directive executes the string 'cmd' and is true provided
this command can be executed and returns a zero value for an
exit code. The end of 'cmd' must be punctuated by a semicolon
and this semicolon will have to be escaped if interpreted by
whatever command line interpreter you are using. An argument
of {} in cmd is replaced by the full path name of the current
file.
-ok cmd
- 'ok' is the same as the -exec directive except that the
command to be executed (with {} expanded) is first printed
followed by a question mark. Execution of the command
proceeds only if the user enters a 'y' (or 'Y'). If any other
response is given, the command is not executed and the
directive fails.
-newer file
- the date stamp on the current file is compared with that of
the given file and true is returned if the current file is
newer than the given file.
-mtime n
- succeeds if the modification time of the current file is n
days from the current time.
-perm string
- succeeds if the current file has the permissions that are
specified by the given string. Permissible characters in the
string are 'r', 'w', 'e', 'd', in any order or 'n' for no
permission. Note: these are permissions as listed by 'dir' or
'list' and not the protection specifications as stored by the
operating system.
( expression )
- is true if the boolean expression within the parentheses is
true.
In the above descriptions, the number 'n' refers to a decimal
integer and can be written as:
+n - which means greater than n;
-n - which means less than n; or
n - which means exactly n.
Combination of the boolean directives above can be done using the
following operators (in order of decreasing precedence):
a) '!' - unary NOT operator.
b) and - this operation is implicit (i.e. no operator); the
directives are simply concatenated together.
c) -o - 'or' operator.
Examples
--------
- to list all files on the internal drive:
find df0: -print
- to remove all editor backup files that are more than two weeks old
from a system with two hard disks (name depends on editor):
find dh0: dh1: -name *.bak -mtime +14 -exec delete {} ;
- to list all source and header files in a source directory:
find :src ( -name *.c -o -name *.h ) -print
NB: Don't forget to escape * and ; if necessary.