Find php files within any matching directory name?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find php files within any matching directory name?
# 1  
Old 09-23-2010
Find php files within any matching directory name?

I am trying to search my linux box for any PHP files located within ANY directory matching a certain name. So far nothing I've tried (nor any idea I've searched for) has worked as expected. I have tried a combination of find and grep...fail.

Please help?
# 2  
Old 09-23-2010
MySQL

try with the following example codes.

Code:
find /home/username -iname "*.php"

it will list all the php files
Code:
find /home/username -iname "a*.php"

it will list all the php file name starting with "a/A"

Code:
find -type d -iname "PHP*"

it will list all the directory names starting with php
# 3  
Old 09-23-2010
I am looking for php files with random names, all ending in php (my server was hacked)

Therefore, the files I'm looking for are very random. However, one thing I'm specifically seeing a lot of is the following:

Code:
/img/random.php

or
Code:
/js/random.php

please note that there are 20+ sites, and MANY img folders, as they are mostly created by the exploit. So I need to search for any img folders (for example) containing any php files.
# 4  
Old 09-23-2010
Now that it's the waking hours, wondering if anyone has any additional ideas I can try? Thanks!
# 5  
Old 09-24-2010
Quote:
Originally Posted by macwise7
So I need to search for any img folders (for example) containing any php files.
search the php files in any img or js folders.
Code:
find / -type f -name "*.php" |egrep "/*img*/|/*js*/"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash to copy subfolder and files to matching directory

The bash executes but returns no results and the set -xv showed while the $run variable in blue, was extracted correctly, the $match value in green, was not, rather both values in home/cmccabe/Desktop/f1 were extracted not just the matching. There will always be an exact match from the $run to... (7 Replies)
Discussion started by: cmccabe
7 Replies

2. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

3. Shell Programming and Scripting

Find matching timestamps in two files.

OK. if the first file is : 3184 2014-07-28 04:15 global.Remote-Access 10.111.8.25 81.245.6.25 tcp 3268 3035 2014-07-28 04:16 global.Remote-Access 10.111.8.12 81.245.6.25 tcp 3268If the second file is: 1 Jul 28 04:12 2014-07-28 id967254(BGC-TLW-Cert) Tunneling: User with IP... (8 Replies)
Discussion started by: fxsme
8 Replies

4. UNIX for Dummies Questions & Answers

find Search - Find files not matching a pattern

Hello all, this is my first and probably not my last question around here. I do hope you can help or at least point me in the right direction. My question is as follows, I need to find files and possible folders which are not owner = AAA group = BBB with a said location and all sub folders ... (7 Replies)
Discussion started by: kilobyter
7 Replies

5. Shell Programming and Scripting

changing the file-name in a directory for all files matching a particular criteria

i have a directory which consist of multiple files out of which there are some files that has -e in their name. I want to write a script that will change all those file-name to -l example there are some files with name : file1-e.wav file2-e.wav file3-english-e.wav file-4-e.wav ... (3 Replies)
Discussion started by: mukulverma2408
3 Replies

6. Solaris

Look for distinct files under a directory matching a pattern

Hi, I'm searching for a pattern 'java' under a directory but it is returning all the files containing 'java', but I want to have only distinct files not all. please help (2 Replies)
Discussion started by: b.paramanatti
2 Replies

7. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

Hello, I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example. file1 ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies

8. UNIX for Dummies Questions & Answers

find files NOT matching name pattern

Hi, I have following files in my directory: /TESTDONTDEL> ls -alt total 14 drwxr-xr-x 2 oracle dba 1024 May 15 06:30 . -rw-r--r-- 1 oracle dba 40 May 15 06:30 exception.txt -rw-r--r-- 1 oracle dba 19 May 15 06:22 ful_1234_test1.txt -rw-r--r-- 1... (2 Replies)
Discussion started by: sagarparadkar
2 Replies

9. UNIX for Dummies Questions & Answers

Find files matching a pattern

Hi, I am writing a BASH shell script. I would like to count all the files in the CURRENT directory matching a specific pattern. Could someone suggest the best/simplest way to do this. I have thought of these solutions (for simplicity the pattern is all files starting with A): ls -1 *A | wc -l... (5 Replies)
Discussion started by: msb65
5 Replies

10. UNIX for Dummies Questions & Answers

Find matching lines between 2 files

How do I find matching lines between two files? (5 Replies)
Discussion started by: jojojmac5
5 Replies
Login or Register to Ask a Question