Hi Jane,

----- Original Message -----
From: Ryan Thomas
Sent: 21.04.2004, 11:09 Uhr

>I am relatively new at PERL and am learning it for a school project. What I 
>would like to do is write a perl script that can run a complete directory 
>listing including sub-directories and save the result to a text file.
>
>Not sure where to start.

I did something similar recently to create an HTML file:

---
#!/usr/bin/perl -w 
#lister.pl

 use strict; 
 use File::Find; 
 use Cwd; 

 my $dir = cwd; 

 print "<html><head><title>Listing of $dir</title></head>\n<body>"; 

 find ( sub { print qq{<a href="$File::Find::name">$File::Find::name</a><br>\n}; }, 
$dir ); 

 print "</body></html>";
 ---
 
 This script is intended to be called like './lister.pl > index.html'. Leave out the 
HTML tags to create a simple text listing.

HTH,

Jan
-- 
There are 10 kinds of people:  those who understand binary, and those who don't

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to