Shell command to find files in a directory pattern Shell command to find files in a directory pattern shell shell

Shell command to find files in a directory pattern


find /path/to/directory/.  -path "*/match/this/path/*" -type f -name "*.php"


Shell Script:

find /home/*/public_html/images -iname "*php" -exec echo {} \;

You can then change the -exec command to do whatever actions you want to the returned files. In this case, we echo them, but you could easily perform other actions as well.


Let bash expand the files for you and use ls to list them:

ls /home/*/public_html/images/*.php

Example output:

/home/grant/public_html/images/bar.php/home/grant/public_html/images/foo.php/home/marcog/public_html/images/helloworld.php