St.Antario
St.Antario

Reputation: 27375

How to find all files which paths contains a specific directories

I need to find all files which have the following path:

/usr/local/.../site-admin/data.sh

I mean I wanta find all such data.sh which are located in site-admin. Note, that /usr/local may contain multiple site-admin directoires. How can I do that?

Upvotes: 1

Views: 86

Answers (2)

Henk Kok
Henk Kok

Reputation: 201

You will also want to grep so you are sure the file is in a directory site-admin:

find /usr/local -name data.sh | grep site-admin/data.sh$

Upvotes: 1

anubhava
anubhava

Reputation: 784918

You can use find:

find /usr/local -name 'data.sh'

If you want data.sh to be in /site-admin/ only

find /usr/local -path '*/site-admin/data.sh'

Upvotes: 2

Related Questions