$start_dir =".";
$filelist = get_dirlist($start_dir);
for ($c=0; $c";
}
?>
function getFileList($dir)
{
# array to hold return value
$retval = array();
# add trailing slash if missing
if(substr($dir, -1) != "/") $dir .= "/";
# open pointer to directory and read list of files
$d = @dir($dir) or die("getFileList: Failed opening directory $dir for reading");
while(false !== ($entry = $d->read())) {
# skip hidden files
if($entry[0] == ".") continue;
if(is_dir("$dir$entry")) {
$retval[] = array(
"name" => "$dir$entry/",
"type" => filetype("$dir$entry"),
"size" => 0,
"lastmod" => filemtime("$dir$entry")
);
} elseif(is_readable("$dir$entry")) {
$retval[] = array(
"name" => "$dir$entry",
"type" => mime_content_type("$dir$entry"),
"size" => filesize("$dir$entry"),
"lastmod" => filemtime("$dir$entry")
);
}
}
$d->close();
return $retval;
}
$dirlist = getFileList("./");
echo "\n";
echo "Name Type Size Last Mod. \n";
foreach($dirlist as $file) {
echo "\n";
echo "{$file['name']} \n";
//echo "".iconv("EUC-KR","UTF-8",$file['name'])." \n";
//$filename = iconv("EUC-KR","UTF-8",$file['name']);
//echo "$filename \n";
echo "{$file['type']} \n";
echo "{$file['size']} \n";
echo "" . date("r", $file['lastmod']) . " \n";
echo " \n";
}
echo "
\n\n";
?>
===== 다운로드 받기 =====
- http://www.evoluted.net/community/code/directorylisting.php
{{develop:php:dirlistingv2.zip|}}