DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Find Files With A Certain Extension, Where The Files Contain A Certain Search Term

05.17.2006
| 6329 views |
  • submit to reddit
        Searches the current directory and deeper for files ending with the 'php' extension, where the file itself contains 'search_term'. Useful if you're searching a large website with lots of images and you only want to find a certain function or variable.

find ./ -type f -name \*.php -exec grep -il "search_term" {} \;
    

Comments

Snippets Manager replied on Mon, 2008/04/21 - 2:56am

hi, i am new with php. i have one problem that, i am uploaded image successfully and sa ve the path of that uploaded image in database. When i am searching image with its name then it will show proper output but by using extension it can show any output so please help me.