Need to copy files from network

"network"? LAN? WAN? The internet?

Are the 5 destinations local or remote?

Chosing a good solution very much depends on the type of network involved; the size of the files involved; whether those files will always be different or not?

For many cases, using system standard system utilities or obtaining an additional utility will be a better--faster, simpler--solution than writing one in Perl.

I have a code that ...

You might get a better response if you showed us that "code". Is it Perl?

If this has to be done in Perl there are several posibilities for making best use of your cpu and bandwidth.

  1. Copy each file once, and write it 5 times.

    If the source is remote and the destinations local, then you can probably copy the first (local) copy of each file 4 times to the other locations, in the same time as it takes for the next remote file to download.

  2. Depending where in the chain the bottlenecks are, it might be advantageous to overlap the fetching of 2 or more remote files.

    This could be done with asynchronous system commands, forks or threads.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re: Copy Files from network by BrowserUk
in thread Copy Files from network by gpurusho

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.