Achal Neupane
Achal Neupane

Reputation: 5719

Get all the files that match pattern in file name anywhere in unix/linux directories/subdirectories

I have 100s of main directories where I have multiple subdirectories in each main directory and a few subdirectories within each subdirectory. I want to get all the files that match pattern in file name mypattern anywhere in any of those directories/subdirectories. Is there a way to do it?

Upvotes: 1

Views: 1246

Answers (2)

David Hoelzer
David Hoelzer

Reputation: 16331

Sure. This really isn't a programming question, though...

 find . -regex '.*regex_here.*'

Have a look at man find.

Upvotes: 3

Steephen
Steephen

Reputation: 15824

  find <root directory> -name *pattern*

ex: find . -name *nix*

Upvotes: 4

Related Questions