Hi,

I'm basically very new to Perl and I've gone through some of the examples pertaining to secure file copy from a windows based server to an Unix Based server. When using a small file (>10kb) to test the transfer it's successfull, however when the file is bigger (>300kb)the file gets copied partially before truncating and returning an error message. The error message is at the line of scp_put. Below is the script that I'm using.

use warnings; use strict; use Net::SSH2; my $server = "212.100.100.239"; my $datafile = "D:/ETL/RPT/MD/IMSI_SICAP.lst"; #my $datafile1 = "D:\\ETL\\RPT\\MD\\"; my $ssh2 = Net::SSH2->new; die "can't connect" unless $ssh2->connect($server); print "Connected\n"; die "can't authenticate" unless $ssh2->auth(username => 'user',password => 'aaa'); print "Authenticated\n"; my $sftp = $ssh2->sftp; $ssh2->debug(1); my $dir = "/timesten_old/IMSI_SICAP.lst"; $ssh2 ->scp_put("${datafile}","${dir}")or die ("Error"); print "Success\n"; $ssh2->disconnect();

Would really appreciate it if some one could guide me on what I'm doing wrong here. Thanks.


In reply to Unable to transfer file with scp_put using Net::SSH2 by tsandras

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.