Encontre tudo com base na estrutura de pastas

1

Como eu uso o comando find melhor: então ele só lista "webapp / bootstrap.php"?

No momento, tenho:

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

Usando o Debain Squeeze se isso fizer diferença.

    
por John Magnolia 16.03.2012 / 19:45

1 resposta

3

Tente usar -regex

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

Isso deve encontrar os arquivos desejados.

-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.
    
por 16.03.2012 / 19:54