hello,
i want to use "-depth" in command "find" and want to exclude a directory.
the find command should work in HP-UX and Linux.
i see in the find man page:
-prune
If -depth is not given, true; do not descend the current directory.
If -depth is given, false; no effect.
-depth
Process each directory's contents before the directory itself.
so my tests , in the example in want to exclude directory "excludedir", only the example with "-path" works , is there another option to use "-prune" and "-depth" ?
OK
find . -depth ! \( -path "./excludedir/*" -o -type d -name excludedir -prune \) -print
OK
find . ! \( -name excludedir -type d -prune \) -print
NOTOK
find . -depth ! \( -name excludedir -type d -prune \) -print
NOTOK , syntax error in Linux:
find . ! \( -name excludedir -type d -prune \) -depth -print
find: warning: you have specified the -depth option after a non-option argument !,
but options are not positional (-depth affects tests specified before it as well as those
specified after it). Please specify options before other arguments.
regards