What I'm trying to do is get a list of all .PHP, .HTM and .HTML files in a
directory (recursively) and substitute a specific string from every file (if
the string exists).  The code I'm using follows.  It doesn't work.  When I
put it into the array, it only stores 80 objects... not sure why... If I
just raw echo, I get closer to 200.  *shrug*  Also, when it gets the file,
it doesn't seem to be replacing the string.  I'm sure I'm being stupid about
how I'm doing this... If anyone can show me what to do, I'd be very
appreciative.  A lot of the code, BTW, is just debugging stuff...  *sigh*

Jesse Williams
System Administrator
DowNET VoIP Team
Electronic Data Systems

<---- Begin Snippet


function get_HTML_HTM_PHP_List ($dirName) {

        $arrayPath = array();
        $arrayFile = array();
        $d = dir($dirName);
        while($entry = $d->read()) {
                if ($entry != "." && $entry != "..") {
                        if (ereg(".html$", $entry) || ereg(".htm$", $entry) || 
$entry)) {
                                //echo "d:/apache/htdocs/".$dirName."/".$entry."<br>";
                                $arrayPath = array($dirName);
                                $arrayFile = array($entry);
                        if (is_dir($dirName."/".$entry)) {

        //for ($i=0;$arrayFile[$i];$i++){print("$arrayFile[$i]<br>");}

        $string_to_remove = "";;

        $string_to_insert = "";;

        //echo "<h3>" . array_count_values($arrayFile) . "</h3>";

        $a = 0;

        for ($i=0;$arrayFile[$i];$i++)  {

                $fp = fopen("d:/apache/htdocs/$arrayPath[$i]/$arrayFile[$i]", "rw");
                echo "$fp";
                ereg_replace($string_to_remove, $string_to_insert, $fp);
                echo "  Opened d:/apache/htdocs/$arrayPath[$i]/$arrayFile[$i]<br>";



//for ($i=0;$myArray2[$i];$i++){print("$myArray2[$i]<br>");}

End Snippet  ---->

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to