On Sat, 30 Nov 2002, Randum Ian wrote: > I have a directory of files which are split up into sections based on > 'full', 'summary' and 'competitions'. This is shown in the filename as > follows: > > ministry-full-6122002.inc > > I want to be able to search thru the dir looking for all the 'full' > files, then sorting them by date and including them in my html page in > date order.
To get an array full of the file names you want: $interestingFiles = array(); $dir = opendir( "/path/to/directory" ) or die( "Could not open dir" ); while( $dirEntry = readdir( $dir ) ){ if( ereg( "full", $dirEntry) ){ array_push( $interestingFiles, $dirEntry ); } } I'll leave it up to you to sort $interestingFiles by the date in the element values, since I don't recognize a date in your file-naming convention. g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php