Thanks a lot Chris that was a great help. The date is in the last part of the filename. In the example I have posted below:
Ministry is the name of the club. Full is the type of the content. 6122002 is the date - It is in the form ddmmyyyy so the example here is 6th December 2002. Is there a simple way I can just grab the date and sort it by order? Should I change the format of the date to make it easier or something? -----Original Message----- From: Chris Wesley [mailto:[EMAIL PROTECTED]] Sent: 30 November 2002 20:25 To: [EMAIL PROTECTED] Cc: Randum Ian Subject: Re: [PHP] Read Files 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php