title: Omit something from find if directory has specific file in it
body: <p>I need to print all my database configuration, my project uses laravel and CI framework. So in shorts I'm looking for following file.</p>
  <ul>
  <li><code>.env</code> → located at <code>/var/www/example_system/.env</code></li>
  <li><code>database.php</code> → located at <code>/var/www/example_system/application/config/database.php</code></li>
  <li><code>core_db.php</code> → located at <code>/var/www/example_system/app/core/core_db.php</code></li>
  </ul>
  <p>I'm using following find command to perform this task.</p>
  <pre><code>find /var/www -maxdepth 4 -type f -name &quot;.env&quot; -not \( -path &quot;/var/www/*/config&quot; -prune \) -o -path '*core/*' -name &quot;core_db.php&quot; -o -path '*config/*' -name &quot;database.php&quot;
  </code></pre>
  <p>Which print.</p>
  <pre><code>/var/www/baloon/app/core/core_db.php
  /var/www/infinys/application/config/database.php
  /var/www/duffyweb/.env
  /var/www/duffyweb/config/database.php
  /var/www/loseweb/.env
  /var/www/loseweb/config/database.php
  /var/www/resto_app/application/config/database.php
  </code></pre>
  <p>This however fails to meet my need, as it still outputting both</p>
  <ul>
  <li><code>/var/www/duffyweb/config/database.php</code></li>
  <li><code>/var/www/loseweb/config/database.php</code></li>
  </ul>
  <p>even though (I thought) I already explicitly exclude it on my find command using <code>-name &quot;.env&quot; -not \( -path &quot;/var/www/*/config&quot; -prune \)</code> parameter.</p>
  <p>So my question is <strong>How can I exclude something from find, if a directory has specific file in it</strong>. In this case if there was <code>.env</code> file, I want find to <em>exclude</em> <code>config/database.php</code> as I prioritize <code>.env</code> over <code>database.php</code></p>