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