Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I use the find command better: so it only lists "webapp/bootstrap.php"?

At the moment I have:

www-data@site:~$ find . -name "bootstrap.php" -print
./site/public/sapphire/tests/bootstrap.php
./site/public/webapp/bootstrap.php
./site/public/sapphire/tests/bootstrap.php
./site4/subdomains/dev/public2/webapp/bootstrap.php
./site.com/public/webapp/bootstrap.php
./site4/public/webapp/bootstrap.php
./site3/public/sapphire/tests/bootstrap.php
./site2/public/webapp/bootstrap.php
./site/subdomains/cms/public/webapp/bootstrap.php
./site/subdomains/projects/public/harvey/webapp/bootstrap.php
./site/subdomains/projects/public/riverboat/webapp/bootstrap.php
./site/public/sapphire/tests/bootstrap.php

Using Debain Squeeze if this makes a difference.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Try using -regex

find . -regex '.*/webapp/bootstrap\.php'

This should find the files you want.

-regex pattern
          File  name  matches regular expression pattern.  This is a match
          on the whole path, not a search.  For example, to match  a  file
          named './fubar3', you can use the regular expression '.*bar.' or
          '.*b.*3', but not 'f.*r3'.  The regular  expressions  understood
          by  find  are by default Emacs Regular Expressions, but this can
          be changed with the -regextype option.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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