Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
Perl: the Markov chain saw
 
PerlMonks  

Re: Recursive directory listing

by Generoso (Priest)
on Sep 17, 2010 at 14:52 UTC ( #860502=note: print w/ replies, xml ) Need Help??


in reply to Recursive directory listing

You need to use a recursive function like the one below.

#!D:/Programs/PERL/bin/perl.exe -w use File::stat; my $dir = "D:/"; opendir(DIR, $dir) or die $!; while(defined (my $file = readdir(DIR))) { print "$file\n"; if(-d "$file") { print "directory found....\n"; opendir(newDIR, $file) or die $!; while(defined ($file = readdir(newDIR))) { print "got new file!!!!\n"; print "$file\n"; } closedir(newDIR); } } closedir(DIR);


Comment on Re: Recursive directory listing
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://860502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2014-04-17 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (453 votes), past polls