works well now that great,

I was wondering how could i get it to list the files from the subdirectories
as well?

maybe using the -d command ?


cheers

matt.
"James Kipp" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
.
>
> > Im now trying to list a directory, but only the files in that
> > directory that
> > finish with a  perticular ending, say .html, i.e *.html.  Ive
> > got this far,
> > but having troubles, wondering if you could have a look for me:
> >
>
> you are pretty close, try the following
>
> use strict;
> use warnings;
>
> $dir = '/staff/lad/public_html/SWT';
>
> opendir(DIR, $dir) or die "Cannot open directory";
> # read the dir contents into a list, and grep out the . and .. dir entries
> @entries = grep (!/^\.\.?$/ , readdir (DIR));
> closedir(DIR);
> foreach (@entries)
> {
>   print "$_\n" if /.*\.html$/;
> }
>
> ---
> Note, this does not deal with iterating through the subdirs of this
> directory, for that you would have to write a recursion routine OR use
> File::Find which does all that and more for  you. In fact many would say
to
> use File::Find for any job like this. Do a google search for it and you
will
> find plenty of examples, scripts, and documentation for it
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to