<?xml version="1.0" encoding="windows-1252"?>
<node id="481587" title="Re^2: Beginners guide to File::Find" created="2005-08-06 20:50:59" updated="2005-08-09 06:06:10">
<type id="11">
note</type>
<author id="240387">
dwhite20899</author>
<data>
<field name="doctext">
If I have a need to process all of the files in a directory tree, I use  &lt;code&gt;find2perl&lt;/code&gt; to generate a template. If you are familiar with the *ix &lt;code&gt;find&lt;/code&gt; command, there are several options you can use to your advantage, but I usually stick to &lt;code&gt;find2perl / -type f -print &gt; template.pl&lt;/code&gt; . You can substitute any starting directory instead of / to suit, and the &lt;code&gt;-type f&lt;/code&gt; will limit the code to files.
&lt;p&gt;
You should end up with this subroutine:&lt;br&gt; 
&lt;code&gt;sub wanted {
    my ($dev,$ino,$mode,$nlink,$uid,$gid);
    (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &amp;&amp;
    -f _ &amp;&amp;
    print("$name\n");
} &lt;/code&gt;
&lt;p&gt;
I replace the &lt;code&gt;print("$name\n")&lt;/code&gt; with my code that performs an action on every file.</field>
<field name="root_node">
217166</field>
<field name="parent_node">
438273</field>
</data>
</node>
