Posted By

yoblob on 02/25/11


Tagged

perl


Versions (?)

list all files in directory


 / Published in: Perl
 

list all files in dir

  1. opendir(IMD, $dirtoget) || die("Cannot open directory");
  2. @thefiles= readdir(IMD);
  3. closedir(IMD);
  4.  
  5. print "Content-type: text/html\n\n";
  6. print "<html><body>";
  7.  
  8. foreach $f (@thefiles)
  9. {
  10. unless ( ($f eq ".") || ($f eq "..") )
  11. {
  12. print "$f<br />";
  13. }
  14. }

Report this snippet  

You need to login to post a comment.