ruby copy folder with subfolders to a target location ruby copy folder with subfolders to a target location ruby ruby

ruby copy folder with subfolders to a target location


It looks like the FileUtils.copy_entry method will copy a directory tree for you.There is some information in the rubydoc : http://www.ruby-doc.org/stdlib-2.0/libdoc/fileutils/rdoc/FileUtils.html#method-c-copy_entry

There are lots of options (such as whether to preserve file ownership) but some quick testing shows that you can just pass the source and destination directories in like this:

FileUtils.copy_entry @source, @destination