Method: RJSV::Core::Files.copy

Defined in:
lib/rjsv/core/files.rb

.copy(path_input, path_output) ⇒ Object

Copies all files from the input path to the output path. This is a method that copies all files even those that are invisible to the UNIX system (dot file).



102
103
104
105
106
107
108
109
110
# File 'lib/rjsv/core/files.rb', line 102

def copy(path_input, path_output)
  files = Dir.glob("#{path_input}/**/*", File::FNM_DOTMATCH)
          .select { |f| File.file?(f) }
  files.each do |path_file|
    path_cp = path_file.sub(path_input, path_output)
    FileUtils.mkdir_p File.dirname(path_cp)
    FileUtils.cp(path_file, path_cp)
  end
end