Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: list of files in subdirectories

by sabari (Beadle)
on Jun 06, 2012 at 11:47 UTC ( #974701=note: print w/ replies, xml ) Need Help??


in reply to list of files in subdirectories

You can also use opendir system call

opendir(DIR, "/home/test"); @files = readdir(DIR); closedir(DIR); foreach $file (@files) { next if ($file eq "." or $file eq ".."); print $file; } For More detailed work on this can be found on below Link http://www.perlmonks.org/?node_id=489552
Best Regards, S.Sabarinathan,


Comment on Re: list of files in subdirectories
Download Code
Re^2: list of files in subdirectories
by davido (Archbishop) on Jun 06, 2012 at 16:17 UTC

    This falls short of meeting the OP's clear and simple specification in two ways:

    • It doesn't look in subdirectories.
    • It doesn't bother to check whether $file is actually a file (not everything that shows up in a directory needs to be a file.), so even in the directory that it does process, it's not providing accurate results.

    Remember, the OP wanted to find all files in a directory, including those found in subdirectories.


    Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-08-29 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (286 votes), past polls