CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: list all files in a dir?: Edit Log



parham_m_s
journeyman

Mar 11, 2001, 5:57 AM


Views: 339
Re: list all files in a dir?

try this code:


Code
#!/usr/bin/perl 

print "Content-type:text/html\n\n";

$directory = "PATH TO DIR";

opendir (DIR,$directory);
@files = readdir(DIR);
closedir (DIR);
foreach $file (@files) {
if ($file ne ".") {
if ($file ne "..") {
print "$file\n";
}
}
}

exit;

i just realized there was a double post of this :(

(This post was edited by parham_m_s on Mar 11, 2001, 5:00 AM)


This post has not been edited


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives