I have this script that searches the given location. Right now it searches the subfolders in that directory. I don't want it to search the subfolders. What can I do to make my script only search the files in the directory?

Thanks

find( \&filehandler, "L:\\renws\\billing\\uploadh");

for my $filename ( sort keys %directories ) {
    my @dirlist = @{$directories{ $filename } };
    if ( scalar @dirlist > 0 ) {
     for ( @dirlist ) {
     my $RP1file = $_;
     my $local_file1 ="C:\\$RP1file";
     my $ftp = Net::FTP->new($host,Timeout=>240);
        $ftp->login;
        $ftp->cwd($path);
               $ftp->get($RP1file,$local_file1);
               $ftp->delete($RP1file);
               $ftp->quit;
            }
        }   # if
    }   # for

sub filehandler {
#Check that it's a file, not a directory
    return unless -f $File::Find::name;

# Just take the filename, convert to lowercase
    my $nameonly = $_;

    # See if it's a RP1 file
    return unless $nameonly = /.RP1/;

$directories{ $nameonly }= [] unless defined $directories{$nameonly };
    push( @{$directories{ $nameonly } }, $_ );
    }

In reply to I don't want to search subfolders by jcalhky

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.