Re: all files in a directory

From: Date: Fri, 05 Sep 2003 10:03:07 +0000
Subject: Re: all files in a directory
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-30345@lists.php.net to get a copy of this message
On Fri, 5 Sep 2003, FB wrote: } I need a small script of php selecting all the files in a directory and } putting the names in an array. } } Also, selecting a specific type might be helpfull like *.TXT Untested: $dir = dir('/your/dir/here'); while ($file = $dir->read()) { if (preg_match('/\.TXT$/i', $file)) { $matches[] = $file; } } $dir->close(); Your files will be in the $matches array. /vjl/ -- Vince LaMonica UC Irvine, School of Social Ecology W3 Developer <*> 116 Social Ecology I, Irvine, CA 92697 vjl@uci.edu http://www.seweb.uci.edu/techsupport Tower: "Delta Zulu Romeo, turn right now and report your heading." Pilot: "Wilco. 341, 342, 343, 344, 345..."

« previous php.db (#30345) next »