Patelkiranat1983′s Weblog

Just another WordPress.com weblog

List files in dir

<?php
echo ‘<h1>Index of /adult/</h1>’;
echo ‘<ul>’;
echo ‘<li><a href=”/”> Parent Directory</a></li>’;

$dir = scandir(‘.’);
$files = count( $dir );
for ( $i = 0; $i < $files; $i++ )
{
if ( is_file($dir[$i]) && strlen( $dir[$i] ) <= 36 && ( strstr( strtolower( $dir[$i] ), ‘.htm’ ) || strstr( strtolower( $dir[$i] ), ‘.html’ ) || strstr( strtolower( $dir[$i] ), ‘.php’ ) ) )
echo “<li><a href=\”$dir[$i]\”>$dir[$i]</a></li><br>”;

if ( is_dir($dir[$i]) && $dir[$i] != “.” && $dir[$i] != “..” && $dir[$i] != “adult” )
echo “<li>FOLDER – !!!! <a href=\”$dir[$i]\”/>$dir[$i]/</a></li><br>”;
}

echo ‘</ul>’;
?>

August 9, 2007 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.