Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: File::Find preprocess

by pvaldes (Chaplain)
on Jan 08, 2018 at 17:13 UTC ( [id://1206923]=note: print w/replies, xml ) Need Help??


in reply to Re^2: File::Find preprocess
in thread File::Find preprocess

Hum, I see. I was expecting an equivalent to the "previously" condition in a common-lisp loop structure. A chunk of code that happens only once before the main body of the function starts iterating. I understand that if I need to do something within each subdirectory (check if something happens inside each subdir first), I would need then to traverse the tree two times using two different find functions. One for directories only, and a second for all files. Right? can't be done in one take?

Replies are listed 'Best First'.
Re^4: File::Find preprocess
by stevieb (Canon) on Jan 08, 2018 at 17:20 UTC

    I'm a bit unclear exactly what you're asking, but if you want to do something for files and something different for directories:

    sub wanted { if (-d){ print "directory\n"; } if (-f){ print "file\n"; } }

      Mmmh. Could work, I'll try this and see what happens. Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-20 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found