Jump to content

Why does is_dir return false when numeric directory name


korazy

Recommended Posts

Why does the following is_dir command return false when the directory name is all numeric e.g. /folder/2004/02, is_dir return false on /folder/2004

 

Development is done a windows xp with apache.  production is on a godaddy shared linux hosting server.

 

<?php

list_dir('.',true);

 

function list_dir($path,$recurse) {

$d = array();

$f = array();

 

if ($handle = opendir($path)) {

 

print('<h3>'.substr($path,1).'</h3>');

 

while (false !== ($file = readdir($handle))) {

if ($file != "." && $file != "..") {

if (is_dir($file.'/')==true) {

$d[] = $file;

} else {

$f[] = $file;

}

}

}

closedir($handle);

 

sort($d);

sort($f);

 

print('<table>');

 

// print

foreach ($f as $i) {

if (substr($i,0,1)!='.') {

$fpath = $path.'/'.$i;

$d1 = time();

$d2 = filemtime($fpath);

$i1 = ($d1 - $d2)/60/60/24;

print('<tr>');

print('<td width=300><a href="'.$fpath.'">'.$i.'</a></td>');

print('<td align=right width=160>');

if ($i1<3) { print('<b>'); }

print(date("Y-m-d H:i:s", $d2));

if ($i1<3) { print('</b>'); }

print('</td>');

print('<td align=right width=160>'.number_format(filesize($fpath)/1000,0,'.',',').' KB</td>');

print('</tr>');

}

}

 

print('</table>');

 

if ($recurse==true) {

foreach ($d as $i) {

list_dir($path.'/'.$i,$recurse);

}

}

 

}

}

?>

 

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.