Top Level Namespace
Instance Method Summary collapse
Instance Method Details
#copy_files(source_dir, glob_pattern, target_dir, exclude_pattern) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/dotkit.rb', line 104 def copy_files(source_dir,glob_pattern,target_dir,exclude_pattern) Dir.chdir(source_dir) do Dir.glob(glob_pattern).each{|file| if(!file.include?(exclude_pattern)) target_file = target_dir + "/" + file target_parent = File.dirname(target_file) FileUtils.mkdir_p(target_parent) if(!Dir.exist?(target_parent)) FileUtils.copy(file,target_file) puts " copied " + file + " to " + target_dir end } end end |