I'm trying to use find
on Solaris 10 to list the contents of one directory, excluding subdirectories from the search. I tried a command based on the solution suggested by sdaau:
find /tmp -type d ! -perm -u+rx -prune -o -type f -name dsm\*
Unfortunately, in addition to returning the desired results, this still results in errors like these:
find: cannot read dir /tmp/hsperfdata_oracle4: Permission denied
find: cannot read dir /tmp/hsperfdata_jsweb: Permission denied
There are a couple of directories in /tmp to which the user executing find
has neither read nor traverse (execute) authorization.
-bash-3.2$ ls -ld /tmp/hsp*
drwxr-x--- 2 jsweb other 117 Jan 5 13:00 /tmp/hsperfdata_jsweb
drwxr-x--- 2 oracle4 dba4 117 Nov 5 19:51 /tmp/hsperfdata_oracle4
drwxr-xr-x 2 root root 117 Jan 22 08:58 /tmp/hsperfdata_root
I need to find a way to eliminate these errors so that find
does not end with a non-zero return code. What am I overlooking?