Directory Listing Script

Any other programming language that is not covered in the Web Scripting category.

Directory Listing Script

Postby kotuk on Mon Apr 17, 2006 10:20 pm

Hi
Does anyone know about good script for recoursive directory listing?

Thanks
kotuk
Contributer
Contributer
 
Posts: 24
Joined: Sat Apr 15, 2006 7:42 pm

yup

Postby selket on Mon Apr 17, 2006 11:19 pm

Try:

ls -R

-selket
selket
Contributer
Contributer
 
Posts: 44
Joined: Sat Apr 15, 2006 11:59 pm
Location: Chicago, IL

Postby kotuk on Tue Apr 18, 2006 9:27 am

Heh... yes... it's the right answer...but.... (of course I forget to say it)
I want it also to build a HTML page(s) containing this listing

sorry for mislead you.
kotuk
Contributer
Contributer
 
Posts: 24
Joined: Sat Apr 15, 2006 7:42 pm

Postby selket on Tue Apr 18, 2006 3:41 pm

echo '<html><body><pre>' >index.html
echo `ls -R` >> index.html
echo '</pre></body></html>' >> index.html

-selket
selket
Contributer
Contributer
 
Posts: 44
Joined: Sat Apr 15, 2006 11:59 pm
Location: Chicago, IL

Sorry

Postby selket on Tue Apr 18, 2006 3:46 pm

Sorry, should be:

ls -R -w 80 >> index.html
selket
Contributer
Contributer
 
Posts: 44
Joined: Sat Apr 15, 2006 11:59 pm
Location: Chicago, IL

Postby kotuk on Tue Apr 18, 2006 5:50 pm

it's won't get me an option to browse my files in the directory. It will give me file description... with their permission (don't think other care about) and not the links.
kotuk
Contributer
Contributer
 
Posts: 24
Joined: Sat Apr 15, 2006 7:42 pm

Postby selket on Tue Apr 18, 2006 9:21 pm

selket
Contributer
Contributer
 
Posts: 44
Joined: Sat Apr 15, 2006 11:59 pm
Location: Chicago, IL

Postby kotuk on Wed Apr 19, 2006 8:18 am

Thanks Smile
kotuk
Contributer
Contributer
 
Posts: 24
Joined: Sat Apr 15, 2006 7:42 pm

Postby ravenhair on Wed Apr 19, 2006 5:41 pm

A php method. This only does the current directory. But if placed as index.php in each directory it will work and be dynamic.

<?php
$dir = '.';
$pattern = '/^\.*/i';
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}

foreach ($files as $value) {
#preg_match($pattern, $value, $matches);
#print_r($matches);
#echo "<a href=\"$matches[0]\">$matches[0]</a><br>\n";
echo "<a href=\"$value\">$value</a><br>\n";
}
?>
ravenhair
Regular
Regular
 
Posts: 80
Joined: Tue Nov 08, 2005 5:51 pm

Postby kotuk on Wed Apr 19, 2006 7:39 pm

Thanks, it's nice too.. also I am not so familiar to PHP
kotuk
Contributer
Contributer
 
Posts: 24
Joined: Sat Apr 15, 2006 7:42 pm

Postby cons00m on Thu Apr 20, 2006 12:29 pm

Try perl cgi and use Data::Dumper

~c[drunk]
cons00m
Contributer
Contributer
 
Posts: 34
Joined: Thu Mar 23, 2006 12:36 am


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron