find – exclude directory or file pattern

To exclude directory or file pattern when using find on command line one can use

! -name "pattern_to_exclude"

Example

To exclude a directory using its name

$ find . -name "*.java" ! -name "dir_to_exclude"
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments