I am using a find command this way:

find ./my_path -name "*.ext1" -exec echo {} \;

And it would work.

Now with multiple extensions, the following command would display several files :

find ./my_path -name "*.ext1" -o -name "*.ext2" 

But when using -exec:

find ./my_path -name "*.ext1" -o -name "*.ext2" -exec echo {} \;

No files are displayed. What am I doing wrong, shouldn't it display just the same files as my second example?


You need to group the filters:

find ./my_path \( -name "*.ext1" -o -name "*.ext2" \) -exec echo {} \;
|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.