Unix 'find' command to include/exclude subdirectories

Posted by Stan on Server Fault See other posts from Server Fault or by Stan
Published on 2013-11-03T05:07:52Z Indexed on 2013/11/03 9:58 UTC
Read the original article Hit count: 199

Filed under:
|

Say the folder structure looks like this:

.
|--folder1
   |--subfolder1
      |--subfolder2
   |--subfolder2
|--folder2
   |--subfolder1
      |--subfolder2
   |--subfolder2
|--folder3
   |--subfolder1
   |--subfolder2

I would like to find all files in subfolder2 only. I know I can just do this:

$ find . -type f |grep subfolder2

But was wondering if find comes with a option to include/exclude given directories?

© Server Fault or respective owner

Related posts about unix

Related posts about find