note 21695 deleted from ref.dir by sniper

From: Date: Thu, 15 Dec 2005 23:59:28 +0000
Subject: note 21695 deleted from ref.dir by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100245@lists.php.net to get a copy of this message
Note Submitter: ben AT tech-space DOT net ---- //lists all files in a directory with a given file name convention function list_dir($file_name_convention) { switch ($file_name_convention) { case 'dated_reports': //matches files like '5_23_2002.html' $this_regexp = "/[0-9]{1,}_[0-9]{1,}_[0-9]{4,}/"; break; //add more cases of file name conventions } $this_dir = dir('.'); if ($this_regexp != null) { while ($file = $this_dir->read()) { if (preg_match($this_regexp, $file)) { $result_array[] = $file; } } } return $result_array; }

« previous php.notes (#100245) next »