cmd find: exclude directory when using option -depth

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

No Help ?

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

You already have not one but two ways that work with -depth and -prune. I have no idea what else you want.

The warning is just a warning. Put the -depth immediately after the . and it will go away.