I need to perform a non-recursive find in Unix. Sounds simple, but it doesn't actually work. The command ALWAYS searches through the subdirectories.
Any ideas? I am on DEC Unix
I need to perform a non-recursive find in Unix. Sounds simple, but it doesn't actually work. The command ALWAYS searches through the subdirectories.
Any ideas? I am on DEC Unix
use the find command with -xdev option
eg
find / -name (search file) -xdev
Ur problem is that U had not gone the man pages of find
Please make sure U read the help pages of find .
Acctually find ->> utility recursively descends the directory
hierarchy for each path seeking files that match......
so please checkout with UNIX man pages and try it
it would fun if U could use grep or fgrep with find ....
Please try it and reply
The xdev option will work only if all of his subdirectories are mount points. Not exactly a general solution.
If want to keep find in one directory, replace
find dir ...
with:
find dir \( ! -name dir -prune \) ...
So
find . -type d -print
will list each subdirectory all the way down your directory structure. But:
find . \( ! -name dir -prune \) -type d -print
will list only the subdirectories in the current directory.