[Pugged] File listings
Dave J. Hala Jr.
ciapug@ciapug.org
22 Nov 2002 09:45:15 -0600
Thanks. Here's what I ended up with.... Its still needs some work,
but its close...
function get_file_list($search_dir,$mask)
{
$f="0";
if ($handle = opendir($search_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (ereg($mask,$file)){
$file_name[$f] = $file;
$f++;
}
}
}
closedir($handle);
}
sort($file_name);
return($file_name);
}
$list = get_file_list("/var/www/html", "\.ZIP");
$cnt= count($list);
for($x="0"; $x < $cnt; $x++){
echo "<A HREF=\"$list[$x]\">$list[$x]</A> <BR>";
}
On Fri, 2002-11-22 at 09:22, Angie Tollerson wrote:
> Oops, forgot one thing in there, you'll want to do a sort on your array
> of files: sort($array) for example
>
> Angie
>
> Angie Tollerson
> Alliance Technologies Web Programmer
> (515) 245-7628
> tollerson@alliancetechnologies.net
> >>> dave@58ghz.net 11/22/02 05:42 AM >>>
>
> I'm looking for some sample code.
>
> I've got a script that makes some pdf files. I need some code that will
> find all the *.pdf files, put them in order by there file names, and
> then create a page of links so someone can download them
>
> Anyone know where there are some PHP 4.x samples that does this?
>
>
> :) Dave
> --
>
> "...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and
> the Ugly)"
>
> OSIS
> Dave J. Hala Jr.
> 641.485.1606
>
>
> _______________________________________________
> Ciapug mailing list
> Ciapug@ciapug.org
> http://cialug.org/mailman/listinfo/ciapug
>
> _______________________________________________
> Ciapug mailing list
> Ciapug@ciapug.org
> http://cialug.org/mailman/listinfo/ciapug
--
"...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and
the Ugly)"
OSIS
Dave J. Hala Jr.
641.485.1606