On Saturday, June 22, 2002, at 05:28 , Erik Riggenbach wrote:
> so here's my code and the problem is that it doesn't a) ignore the . and > .. > dirs b) it doesn't acknowledge some dirs as being dirs. [..] > readmydirs('/mp3'); > > sub readmydirs{ > opendir(DIR, $_[0]); > my @lists = readdir DIR; > foreach my $element (@lists){ > if(-d $element and !/^\.{1,2}$/){ > print "-"; > print $element; > print "\n"; > # readmydirs($element); > } > else{ > print $element; > print "\n"; > } > } > } what I would do here is the minor sets of modifications: a) my ($dir) = $_[0] opendir(DIR, $dir) or die "Problem opening dir: $dir : $! \n"; remember that what you are going to get out of the "readdir" are names of the directory joe bob fred not /mp3/joe /mp3/bob .... b) my @files = grep { $_ ne '.' and $_ ne '..' } readdir(DIR); c) A recursive DirWalker I have posted at: http://www.wetware.com/drieux/pbl/Sys/Admin/dirWalkerForCheckSum.txt So either you must opt to 'chdir' into the directory so that you see 'joe,bob,fred' as 'leafs' on the current tree - OR - you have to keep appending them on to the $baseDir ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]