Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: File::Find Question

by repson (Chaplain)
on Mar 14, 2001 at 10:58 UTC ( #64338=note: print w/ replies, xml ) Need Help??


in reply to File::Find Question

What you want to start with is perlman:-X, which describes a series of functions for testing file/directory types. These can be used with $_ which will be set to the current filename, and the directory will be chdired to the appropriate place to use it. $File::Find::name (the full path) and $_ can then be used with common string operations to find if the file/directory name suits your conditions.

Here is a possible starting point I put together:

find( sub { if (-d $_) { if (/^questionable/) { dir_func_1($File::Find::name); } elsif (/-(\d{6}-\d{6})$/) { dir_func_2($_,$1); } # Uncomment following line to prevent furthur recursion. # $File::Find::prune = 1; } else { # you may want furthur tests before assuming good file file_func($_); } }, $intdir);

Updated: Changed chmod to chdir, stupid me


Comment on Re: File::Find Question
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-08-29 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (287 votes), past polls