On Thu, 20 Mar 2003, Christopher M Burger wrote:

> Hello,
> 
> I was wondering if anyone had any ideas on how I can get a list of
> directories and subdirectories. 

Take a look at File::Find, comes with the standard distribution
perldoc File::Find

> 
> 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.
> 
> My output than will look like this.
>  A\
>  A\1\
>  A\2\
>  B\
>  B\1\
>  B\2\a\
>  B\3\
> 
> And so on.  I do not how many directories or subdirectories their will be.
> Any ideas will be greatly appreciated.
> 
> Thanks
>  
> 
> 
> 
> 


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

Reply via email to