Christopher M Burger wrote:

> Hello,
>
> I was wondering if anyone had any ideas on how I can get a list of
> directories and subdirectories.
>
> I'm currently trying something like this:
>
> sub GetDirList {
>
>   opendir (D_LIST, $_[0]) or die "Could not open directory $_[0]";
>   while ( defined ($vf = readdir D_LIST) ) {
>    next if $gf =~ /^\.\.?$/; # skip . and ..
>    if (-d "$_[0]/$vf") {
>     $file_list .= "$_[0]<BR>";
>     $z="$_[0]/$vf";
>     GetDirList($z);
>    }
>   }
>   closedir DIRECTORY_LIST;
>
> }
>
> I'm sure this is not right but my goal is to look at a directory and it to
> my list than check to see if there is any subdirectories.  If there is do it
> again.

How do you know this is not right?  Aside from indications that you do not use strict, 
and to do not declare your variables with my, this looks like it will probably work.  
The first one to ask about whether code will work is your Perl interpreter. Test the 
code!  Then, if you get errors or unexpected results, and you are not sure what they 
mean, post to the list with error messaages and the lines of code they refer to.

Joseph


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

Reply via email to