FreeKB - Linux FIND command - Exclude directories from search
Linux FIND command - Exclude directories from search

If you are not familiar with the find command, check out our Getting Started article.

Let's say you want to search for files below /opt but you do not want to search /opt/tmp and /opt/user. The following command will exclude /opt/tmp and /opt/user from the search.

~]# find /opt –not \( -path /opt/tmp –prune \) –not \( -path /opt/user –prune \)

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter f7824 in the box below so that we can be sure you are a human.




Comments