Well the short answer is "Yes" it is possible to create code which does this.

 I think that most people would question why you would wish to do this though, there are many tools which solve this problem already which have been mentioned above.

 If you have some specific problem with them then you should probably mention it - instead of looking to reinvent the wheel.

 For example you might have a problem with entering passwords - in which case you should investigate the use of shared keys and SSH, making passwords unnecessary.

 Or if you do not have root access to the machine you wish to copy files to, and cannot install or modify software there then that might be a valid vetoing option. However you may be able to do things in reverse in that case, instead of connecting to the machine connect from there and "pull" the files.

 The perl code to do the copying is going to open up a whole can of worms:

 Those are just a small list of things that occur to me.

 However if you really want to do this, and it's not exposed to the internet you should start by looking at IO::Socket::INET, File::Copy and related modules.

Steve
---
steve.org.uk

In reply to Re: Re: Re: Copying files using a specific port by skx
in thread Copying files using a specific port by rupesh

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.