Link to home
Start Free TrialLog in
Avatar of James Williams
James WilliamsFlag for United States of America

asked on

PHP get all files in DIR

My question stem form an old one I asked a while back.
OLD Question

In the code below I am trying to change the first line  Into code that will get all the files in a DIR
and run the rename script on each of them.

Exact file names are unknown.

Any help is appreciated.
Thank you

Selvol
<?php
$str = file_get_contents("a.php");
        preg_match('%<meta name=\"keywords\" content=\"([^"]*)"%i',$str,$matchArray);
        $namesArray = explode(",",$matchArray[1]);
        $file = fopen($namesArray[0].$namesArray[1].$namesArray[3].".txt","w+");
        fwrite($file,$str);
        fclose($file);
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James Williams

ASKER

Thank you for the help.  

Selvol