I cannot figure out how Net::FTP set its local current directory for gets
of remote files?  Does anyone know?
I want to get remotefile from remotehost using:
but I want to place this file in $localdir not in what Net::FTP claims to
be

get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
      Get REMOTE_FILE from the server and store locally. LOCAL_FILE may be
      a filename or a filehandle. If not specified, the file will be stored
      in the current directory with the same leafname as the remote file.


      If WHERE is given then the first WHERE bytes of the file will not be
      transferred, and the remaining bytes will be appended to the local
      file if it already exists.


      Returns LOCAL_FILE, or the generated local file name if LOCAL_FILE is
      not given. If an error was encountered undef is returned.

please help!

thx
derek

#!/usr/bin/perl


use strict;
use warnings;
use diagnostics;
use Net::FTP;
require 5.8.0;
$ENV{"PATH"} = qq(C:\\Perl\\bin:C:\\Documents and Settings\\mh-hl7:);

my $p= qq(--passphrase-fd 0);
my $de= qq(--decrypt);
my $outp= qq(--output);
my $MHfile= qq(C:\\Documents and Settings\\mh-hl7\\MHFM.txt.asc);
my $pass= qq(C:\\temp\\pass.txt);

sub ftpme {
          my $remotehost = "216.54.146.8";
          my $remotedir  = "cloverleaf";
          my $localdir   = "C:\\Documents and Settings\\mh-hl7";
          my $user       = "...";
          my $pass       = "...";
          my $data       = "MHFM.txt.asc";
          my $ftplog     = "C:\\temp\\ftpxfer_to_OH.log";

          open (FTPLOG, ">$ftplog") or warn "was unable to open FTPLOG $!";
          my $ftp = Net::FTP->new($remotehost, Debug => 10)
          or do {print FTPLOG "Cannot connect to $remotehost $!";};
          $ftp->login($user,$pass) or do {print FTPLOG "Login failed $!";};
          $ftp->binary();
          $ftp->cwd($remotedir);
          $ftp->get($data) or do {print FTPLOG "Get data failed $!";};
          $ftp->quit;
}

#unlink $MHfile;

ftpme();

if ( -s $MHfile ) {
    open (PASS, "+<$pass") or warn "was unable to open FH $!";
    for (;<PASS>;) {
        print $_;
    }
}
#else {
 #   print "file $MHfile not present","\n";
  #  system ("C:\\WINDOWS\\notepad.exe C:\\temp\\pass.txt");
#}

close (PASS) or warn "was unable to close FH $!";

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to