It seems as if you don't actually need
find at all here.
for pathname in "$dir"/*.out; do
[ ! -f "$pathname" ] && continue
# do whatever you need to do to "$pathname" here
"$pathname" would point to a regular file or a symbolic link to a regular file. Note that hidden files would be skipped as
* does not match filenames starting with a dot (unless the
dotglob shell option is set in
bash, which you may or may not be using).
find "$dir" -mindepth 1 -type d -prune -o -type f -name '*.out' -print
-mindepth 1 causes the starting directory to not get pruned by
-type d -prune. The
-print should be replaced with the action that you would want to take on the found pathnames (which will be of regular files that has names ending with
find "$dir" ! -path "$dir" -type d -prune -o -type f -name '*.out' -print
This only uses standard
find options and prunes all directories that are not the same as the starting path.
find "$dir" -maxdepth 1 -type f -name '*.out' -print
-maxdepth 1 would, more simply, stop
find from descending into any of the start directory's subdirectories.
-maxdepth options, although commonly available, are extensions to the standard
find command, and if your implementation of
find does not have them, you would have to go with the shell loop or the
find alternative that uses
-prune only (with