find without recursion find without recursion unix unix

find without recursion


I think you'll get what you want with the -maxdepth 1 option, based on your current command structure. If not, you can try looking at the man page for find.

Relevant entry (for convenience's sake):

-maxdepth levels          Descend at most levels (a non-negative integer) levels of direc-          tories below the command line arguments.   `-maxdepth  0'  means          only  apply the tests and actions to the command line arguments.

Your options basically are:

# Do NOT show hidden files (beginning with ".", i.e., .*):find DirsRoot/* -maxdepth 0 -type f

Or:

#  DO show hidden files:find DirsRoot/ -maxdepth 1 -type f


I believe you are looking for -maxdepth 1.


If you look for POSIX compliant solution:

cd DirsRoot && find . -type f -print -o -name . -o -prune

-maxdepth is not POSIX compliant option.