FileUtils cp_r

Discussion in 'Ruby' started by Newb Newb, Apr 25, 2009.

  1. Newb Newb

    Newb Newb Guest

    Hi...

    i want to copy a folder recursively

    i did it using cp_r(source,destination)

    it works correctly.

    but it sould not be overwritted...

    how can i do it pls help me..

    even i used remove_destination => false...

    but it gets overwritted...

    any advices...

    Thanks
    --
    Posted via http://www.ruby-forum.com/.
     
    Newb Newb, Apr 25, 2009
    #1
    1. Advertising

  2. Newb Newb

    Hunt Jon Guest

    Maybe you can use

    unless File.exists?(destination) or Dir.exists?(desitination)
    cp_r(source,destination)
    end
     
    Hunt Jon, Apr 25, 2009
    #2
    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. Rebhan, Gilbert

    get new files in dstdir before cp_r

    Rebhan, Gilbert, Feb 27, 2007, in forum: Ruby
    Replies:
    1
    Views:
    126
    Brian Candler
    Feb 27, 2007
  2. James Byrne
    Replies:
    2
    Views:
    117
    Luis Lavena
    Mar 31, 2008
  3. Marc Heiler

    FileUtils.cp_r

    Marc Heiler, Jul 18, 2008, in forum: Ruby
    Replies:
    3
    Views:
    154
    Ryan Davis
    Jul 19, 2008
  4. Paul Lynch

    FileUtils.cp_r is slow?

    Paul Lynch, Jan 14, 2009, in forum: Ruby
    Replies:
    5
    Views:
    138
    Luc Evers
    Jan 19, 2009
  5. Edouard Dantes

    FileUtils.cp_r - works with regex?

    Edouard Dantes, Feb 9, 2009, in forum: Ruby
    Replies:
    2
    Views:
    172
    7stud --
    Feb 9, 2009
Loading...

Share This Page