You seem to keep shuffling code around. How could the above even be close to working? You have an exit right after you get the directory names. If you take that out, the loop that used to process each one is now commented out. Instead, you're now calling find with the directory $File::Find::dir which is a package variable find initializes during a find ... so you're asking find to look in no directories now (I think) since that would be undefined until a find call is made.

What's going to give you the most mileage here is to break down each piece and start small, adding debugging to make sure it's doing what you think. e.g., instead of jumping directly to trying to traverse directories and copy files, how about traversing them and printing the file names? That way you know what you're getting before you try to copy it. That way you can also show us some output so we can see what the program thinks it's doing.

For me, I think it's time to:

find(\&sleep, $bed);

In reply to Re: finding files and copying them using File::Fiind & File::Copy by steves
in thread finding files and copying them using File::Fiind & File::Copy by skyler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.