perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@liquidation.com>
Subject Re: Trying to get File and Directory info off of external server quickly
Date Mon, 01 Aug 2005 23:31:53 GMT
Boysenberry Payne wrote:
> my $h = $ftp->{handle};
> foreach my $directory ( @directories ) {
>     $h->cwd( $directory ) or die "can't change to directory: $directory 
> $!";
>     my $dir_ls = $h->ls;
>     foreach my $file_name ( @$dir_ls ) {
>         unless ( substr( $file_name, 0, 1 ) eq "." ) {
>             my $dir_nfo = $h->dir( $directory . $file_name );
>             $_ = $dir_nfo->[ 0 ];
>             s/(\s)+/ /g;
>             my @file_nfo = split / /, $_;
>             my $file_size = $file_nfo[ 4 ];
>             if( $file_size != 0 ) {
>                 add to database
>             }
>         }
>     }
> }
> $h->quit;
Whats this ftp->{handle} stuff ?
Shouldn't it just be $ftp->xxx
Thats not in perldoc Net::FTP.

Are you using a relatively new version of it ?
We've got Net::FTP 2.75,
Linux wickedwitch 2.6.12.3 #2 SMP Mon Jul 18 17:14:55 EDT 2005 i686 i686 
i386 GNU/Linux

What is the file size check for .. why do you have files of size 0 ?

I think it might be faster to do

next unless $file_name =~ /^\./o;

instead of
 >         unless ( substr( $file_name, 0, 1 ) eq "." ) {

It might be your database connection... Do you prepare the handle 
outside of the loop?  Is the database connect/disconnect outside of the 
loop? What are you inserting into the database ? If you're inserting a 
BLOB of the image/file data it could be the bandwidth transfer now thats 
its not a local socket anymore.

Luck

-- 
END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
Cell:   301.254.5198
E-Mail: pgollucci@liquidation.com
Web:    http://www.liquidityservicesinc.com
         http://www.liquidation.com
         http://www.uksurplus.com
         http://www.govliquidation.com
         http://www.gowholesale.com


Mime
View raw message