Page 1 of 1

Need solution

Posted: Fri Sep 19, 2008 6:36 am
by aliahsan81
Hi All

I m having problem regarding string,I try to explain i have all the directories, And an array list in which i have some extension like php cgi etc.i am looping through directories to find the files with php cgi extension,if those found print dir name and count.problem is dir name are printing many time in loop i paste my code.When i print dir name out off loop still get dir name many times.One thing more variable $dir_name contain all the dir name which i m getting from an other function.

if( $files[$k] != '.htaccess' && $files[$k]!='.' && $files[$k]!='..' && !is_dir($files[$k] )){
$ext = substr($files[$k], strrpos($files[$k], '.') + 1);

if(in_array($ext,$list)){
$cnt++;
echo dir_name;

OutPut

/var/www/html/test/abc _Writable_dir_unusual_file 1
/var/www/html/test2 _Writable_dir_unusual_file 1
var/www/html/test3 _Writable_dir_unusual_file 1
var/www/html/test3 _Writable_dir_unusual_file 2
/var/www/html/test3 _Writable_dir_unusual_file 3

Re: Need solution

Posted: Fri Sep 19, 2008 10:45 am
by pickle
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Re: Need solution

Posted: Fri Sep 19, 2008 3:24 pm
by yacahuma
are you doing deep search(are you going all the way down in the dir structure?)