Re: Search for files in a directory?

From: Date: Fri, 01 Sep 2000 18:01:35 +0000
Subject: Re: Search for files in a directory?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14851@lists.php.net to get a copy of this message
I haven't tried this, but I'd do something like: $handle=opendir('.'); while($file=readdir($handle) { if (ereg("^ab",$file)) { echo $file; } } That is, use the ereg to see if the returned file name matches your pattern. In the above case, it would match any file that begins with "ab". On Fri, 1 Sep 2000, spider wrote: > How can I search for files in a directory matching a specific search > pattern, for example files matching "ab*.*" or even "*.*"? > Help is greatly appreciated! > > Sincerely > Martin > > > >

« previous php.general (#14851) next »