This is my folder structure:
/site1/myFolder/otherFolder1/a.gif
/site1/myFolder/otherFolder1/b.png
/site1/myFolder/otherFolder1/c.php
...
/site2/myFolder/otherFolder2/d.gif
/site2/myFolder/otherFolder2/e.png
/site2/myFolder/otherFolder2/f.php
...
/site3/myFolder/otherFolder3/g.gif
/site3/myFolder/otherFolder3/h.png
/site3/myFolder/otherFolder3/i.php
...
Got this far:
find /var/www/html -type d -name myFolder -exec find {} -name "*.php" \; for i in `find /var/www/html -type d -name myFolder -exec find {} -name "*.php" \;` do some_house_keeping_here done
But I want to do something like this:
find /var/www/html -type d -name myFolder -exec find {} -name "*.php" -exec do_some_housekeeping {} \; \;
Click the Start button, type the file name or keywords with your keyboard, and press Enter. The search results will appear. Simply click a file or folder to open it.
You can use combination of ls command, find command, and grep command to list directory names only. You can use the find command too.
You can use the -path
option instead of -name
. It would match the entire absolute path with the regex.
find /var/www/html -path "*/myFolder/*.php" -exec do_some_housekeeping {} \;
There is a -path
flag that would probably help a lot.
find /var/www/html -path "myFolder/otherFolder?" -name "*.php" -exec do_some_housekeeping {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With