Last active
August 29, 2015 14:06
-
-
Save jkubacki/a6768d71466277c2b5d1 to your computer and use it in GitHub Desktop.
Replace files in catalog tree from another catalog. Without fileutils and with binary flags for microsoft, fuckin, windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
catalog_search = 'test' | |
catalog_copy_from = 'test2' | |
Dir.glob("#{catalog_search}/**/*").each do |name_target| | |
next if File.directory? name_target | |
name_main = "#{catalog_copy_from}/#{File.basename name_target}" | |
if File.file? name_main | |
content = File.open(name_main, 'rb') {|file| file.read } | |
File.open(name_target, 'wb') {|file| file.write(content) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment