Just another Perl shrine | |
PerlMonks |
I don't want to search subfoldersby jcalhky (Initiate) |
on Jun 15, 2005 at 21:24 UTC ( [id://467063]=perlquestion: print w/replies, xml ) | Need Help?? |
jcalhky has asked for the wisdom of the Perl Monks concerning the following question:
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 } }, $_ ); }
Back to
Seekers of Perl Wisdom
|
|