When I do:
$ find /
It searches the entire system.
How do I prevent that?
(This question comes from an "answer" to another question.)
When I do:
$ find /
It searches the entire system.
How do I prevent that?
(This question comes from an "answer" to another question.)
You may even do
as it's your shell that expands the wildcard. Typing
is equivalent to typing
given foo.jpg and bar.jpg are all the files that end with ".jpg" in the current directory.
Use the -prune option.
You might be better off using wildcards. For instance, if you want to find all ksh scripts in the current directory:
Consider:
G'day,
Just wanted to expand on the suggestion from Jon to use -prune. It isn't the easiest of find options to use, for example to just search in the current directory the find command looks like:
this will stop find from descending into sub-directories within this directory.
Basically, it says, "prune anything that is a directory, whose name isn't ".", i.e. current dir."
The find command evals left to right for each item found in the current directory so after completion of the first element, i.e. the prune segment, it will then continue on with the matched item in your second -o (OR'd) expression.
HTH.
cheers, Rob