James Williams
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
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);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Selvol