How to limit the depth of find command

We can limit the depth of find command to the current directory by using '-maxdepth' flag.

For example,

#find . -maxdepth 1 -type f -exec ls -l "{}" \;

This will list all the files in the current directory (will not give the recursive list).

 

Leave a Reply

Your email address will not be published. Required fields are marked *