Perl FTP Error

Hello

I am running a Perl Script to upload information that I have on a unix box on a daily basis. This script was previously working when I upload from SCO 5.0.5. I have now upgraded to a new Unix box running SCO Openserver 5.0.7. Whenever I run this script it give me an error on the "ls" command. The error that it puts out is "Argument too long". Has anybody every received the type of error. Can someone please point me in the right direction. I would greatly appreciate it.

Here is a copy of the script:

use Net::FTP;

$ip  = "192.168.0.1" ;
$dir = "\/usr2/dataset1" ;
$uname = "abc" ;
$pwd = "abc" ;
$locFile = "f:\\e\\dsa\\test\\rawdata\\" ;

$log = ">>logfile.txt" ;
open(FF,"$log") ;

$dt = gmtime() ;

print FF "$dt\n" ;
print FF "----------------------------------\n" ;

$ftp = Net::FTP->new($ip, DEBUG => 0)  
      or die "Cannot connect to some.host.name: $@";

$ftp->login("$uname","$pwd")
      or die "Cannot login ", $ftp->message;

$ftp->cwd("$dir")
      or die "Cannot change working directory ", $ftp->message;

 
@files = $ftp->ls   ----------------------------------------> here is where I get the error.
      or die "list failed: ", $ftp->message;

$success = 0 ;
$failure = 0 ;
 
foreach $file (@files) {

      
      next unless $file =~ /\.dme|\.dat/gi ;

      $dfile = $file ;
      $dfile =~ s/\.dme/\.dat/g ;

      $dest = $locFile.$dfile ;

      print FF "Copying $file to $dest ... " ;
      print "Copying $file to $dest ... " ;


      $ftp->get("$file","$dest")
       or die "get failed ", $ftp->message;

      
      if (-e $dest) {
            $success++ ;
            print FF "OK\n" ;
            print "OK\n" ;
      } else {
            $failure++ ;
            print FF "FAILED!\n" ;
            print "FAILED!\n" ;
      }
      
}

$ftp->quit;

print FF "-------------------------------\n";
print FF "Successfully copied $success files\n";
print FF "Failed to copy $failure files\n";
print FF "-------------------------------\n\n" ;
close(FF) ;

any help is appreciated.

Thanks
PSOHEALTH_ISAsked:
Who is Participating?
 
jmcgOwnerCommented:
PAQ, 500 points of 500 refunded.
0
 
arombergCommented:
Normally when you get argument too long, that means there is too many files for your ftpd to handle, have you tried clearing out that directory or uploading to a different one?
0
 
PSOHEALTH_ISAuthor Commented:
I have. But the only issue that I have with that is due to the fact that I just upgraded this system on the weekend. It is the same information that I was downloading on my previous server. An exact copy are on both machines. If I run this script on my previous unix box the script works great, but on the new one it crashes everytime.
0
 
jmcgOwnerCommented:
The ftp 'ls' command is often implemented by running an actual command named 'ls' on the remote host. I would check to see whether there is a difference between the 'ls' command that is run for user 'abc' on the old host vs the new host. If someone has introduced a more "user-friendly" command in place of the basic 'ls' command, for instance, it could mess up when called in the context of that same user logged in via FTP. Aside from this hint, I'm not sure what else could account for the difference in behavior that you've seen.
0
 
PSOHEALTH_ISAuthor Commented:
I am actually trying it with the root user and I am having the problem. I haven't been able to figure it out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.