Quicken copy time when processing large files

Discussion in 'Ruby' started by Clement Ow, Apr 4, 2008.

  1. Clement Ow

    Clement Ow Guest

    I just started ruby not too long ago and I'm really new to the language.
    But I came out with something; to copy files from path names to path
    names using each respecive array elements.

    --------------------------------------------------------------------------------
    $options=
    ["2008*", "2008*", "700*", "2008*", "2008*"]

    $source=
    %w[C:/movtest/testing
    C:/movtest/testing/new
    U:/movtest/source
    U:/movtest/new
    U:/movtest/new1]

    $dest=
    %w[U:/test_1/
    U:/dest1/
    U:/dest2/
    U:/dest3/
    U:/dest4/]

    while i<=j && i1<=j1 && i2<=j2

    Dir.chdir($source)
    print "\nSource: " + Dir.getwd + "\t\n"
    print "Dest: " + $dest[i1] + "\n"
    print "Options: " + $options[i2] +"\n"
    FileUtils.cp_r Dir.glob($options[i2]), $dest[i1]
    print "File Mov Test:Success"
    i+=1
    i1+=1
    i2+=1
    end

    --------------------------------------------------------------------------------
    Apparently, when moving large files (i.e file size 50mb) it takes
    relatively long as when i use ROBOCOPY (a robust copying software by
    MSServer), but I cant use robocopy because it has it's limitations,hence
    i used ruby. As I will be running the ruby program on a server, I cant
    afford to use too much memory while transferring files from one folder
    to another as the server is used for more impt tasks like running impt
    applications in the office.

    So is there anything that i could do to quicken the copying process
    without compromising on the ability to have different path names and
    options for copying files? (i understand that arrays do take up more
    memory)
    Thanks in advance. =)
    --
    Posted via http://www.ruby-forum.com/.
     
    Clement Ow, Apr 4, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maxim
    Replies:
    0
    Views:
    420
    Maxim
    Jul 7, 2003
  2. Alex
    Replies:
    2
    Views:
    1,288
  3. Replies:
    1
    Views:
    311
    John Harrison
    Nov 25, 2005
  4. Replies:
    26
    Views:
    2,176
    Roland Pibinger
    Sep 1, 2006
  5. Developer
    Replies:
    4
    Views:
    729
    Daniel Pitts
    Feb 25, 2009
Loading...

Share This Page