Helpful Information
 
 
Category: Perl/ CGI
locating and listing then linking files

hey there,
ok need a script that finds a dir .. the dir will be a variable from url like http://whwatver.com/cgi-bin/script.pl?dirname=whatever
and it opens that "whatever" dir and lists every.txt file in that dir and if you click one of the names of the txt files listed it is linked to the txt file...i havent got very far argh im stumped....

got a lil bit but not much luck...can anyone hep me?
heres what i got which aint much use hehe

parse_form();

$dirname =$FORM{dirname};

opendir(DIR,"$dirname");

$found='no';

while($list=<DIR>){

if ($list=~ m/$dirname/g){
$found='yes';
}
}
if ($found eq 'yes' ) {
print "list of files with <br> between\n";
}
else {
print "No resluts found for $name in our database sorry!\n";

argh any ideas?
thanks lot:)
sir p

i dont get it , you could just get all the files in the dir, (if there is a dir) and then print the array contents, as links,

or am i geting the thing wrong?

and on you rlast script you got all th contents of a dir into an array

Calilo

yeh sorry the script wrong.
your right calilo thats what im after.. so the dir should be found by the url
so if it was to get all files in a dir called "blah" which is located under another dir called "guitar" it would be like www.whatever.com/cgi-bin/myscript.pl?maindir=guitar&dir=blah
hmm does that make sense?
thanks dude:thumbsup:
sir p










privacy (GDPR)