Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading a dir into array?

Status
Not open for further replies.

cleansedbb

Technical User
Feb 11, 2002
95
US
I have several files in directories

the files are like so


/monday/*.log (day logs)
/monday/*.pmlog (night logs)
/tuesday/*.log
/tuesday/*.pmlog
....and so on

how do I read the contents of all of mondays logs and pmlogs to be added to an array and then edited by another script for reports?

what I want to do is have an array called $LOGS and each file in the specified day will be $LOGS[$i] so I can
then do a

$fp = fopen("$LOGS[$i]", "r");
$read = fread($fp, 100);
fclose($fp);
$write = $report_footer;
$fp = fopen("$LOGS[$i]", "a");
fwrite(fp,$write);
fclose($fp);
 
open dir
read all values NOT matchin "." or ".." into an array
then set a regexpression over it to match your needs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top