Jump to content

Display only certain file extensions


mcmuney

Recommended Posts

I'm using the code below to display all files within a folder and sub-folder; however, I'd like to modify to show only 2 types of file. Can anyone help with the mod?

 

<?php

$filelist = explode("\n",`find .|sort`);

// for each item (file) in the array...

for ($count=0;$count<count($filelist);$count++) {

// get the filename (including preceding directory, ie: ./software/gth1.0.9.tar.gz)

$filename=$filelist[$count];

// if it's not a directory, display linked

if (!is_dir($filename))
printf("<font face='Verdana' size='2'><b><a href=\"%s\">%s</a></b></font><br>\n",$filename,$filename);
}

?>

Link to comment
https://forums.phpfreaks.com/topic/191117-display-only-certain-file-extensions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.