Ricky Robinson
Ricky Robinson

Reputation: 22893

find file names containing a choice of strings

In the following example:

sudo find . -path "./*_parameterOne_*_*/*" -exec ./myScript.py {} +

... I actually just want to take files which are in, say

./aFolder/*_parameterOne_100_*/*
./aFolder/*_parameterOne_200_*/*

And exclude all other values (say 300, 400, etc). Is there a way to specify this?

Upvotes: 0

Views: 122

Answers (1)

nosid
nosid

Reputation: 50024

You can use the typical shell patterns:

find . -path "./*_parameterOne_[12]00_*/*" -exec ./myScript.py {} +

If you need more complex patterns, take a look at the options -regex and -iregex.

Upvotes: 4

Related Questions