Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Recursive directory listing

by Generoso (Parson)
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);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://860502]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-03-31 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (364 votes). Check out past polls.