Skip to content

Instantly share code, notes, and snippets.

@banyan
Created December 22, 2009 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banyan/261473 to your computer and use it in GitHub Desktop.
Save banyan/261473 to your computer and use it in GitHub Desktop.
require "fileutils"
files = %w(
file1.txt
file2.txt
)
src_root = '/path/to/src/'
dest_root = '/path/to/dest/'
files.uniq.each do | file |
src = src_root + file
dest = dest_root + file
FileUtils.mkdir_p(File::dirname(dest)) unless FileTest.exist?(File::dirname(dest))
FileUtils.cp( src, dest )
puts "successfully copied from `#{src}` to `#{dest}`"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment