Robert Maxwell wrote:

> Here's a newbie question I guess.  How would I build a list of all
> files on a specified drive, recursively building the list? 
> Suggestions or snippets would be appreciated.

Simplest way would be to use File::Find and test for dir in the wanted
sub so you could treat the dirs differently and check for . and .. to
ignore.

use strict;
use File::Find;

my $dir = shift || "C:/";
print "$dir: \n";
find (\&wanted, $dir);

sub wanted {

return if /^\.{1,2}$/;
print "$File::Find::name: \n" if -d;
print "\t$File::Find::name\n" if not -d; # indent files

}

__END__

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to