Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: searching folder for specific files

by hanenkamp (Pilgrim)
on Feb 23, 2004 at 14:32 UTC ( [id://331105]=note: print w/replies, xml ) Need Help??


in reply to searching folder for specific files

There are actually several ways of doing this. You should look for documentation on glob for one:
do_something($_) foreach (<*.swf>);
You can use opendir, readdir, and closedir and use a regexp or other file-test operation against each file found to determine if it matches your criteria:
opendir FOO, $dir or die $@; foreach (readdir FOO) { do_something($_) if /\.swf$/; } closedir FOO;
Or, if you need to recurse into subdirectories, you should consider File::Find. I'll let the documentation at CPAN illuminate that one for you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found