Skip to content

Instantly share code, notes, and snippets.

@TakashiNakagawa
Last active December 23, 2015 05:59
Show Gist options
  • Save TakashiNakagawa/6590762 to your computer and use it in GitHub Desktop.
Save TakashiNakagawa/6590762 to your computer and use it in GitHub Desktop.
opencvのincludeファイルコピー
require "find"
require "fileutils"
def copy(source_path, target_path)
Find.find(source_path) do |source|
next if File.directory? source
#パスにopencv2が含まれていなければ除外
next unless File.dirname(source).include?("opencv2")
#拡張子がh, hppのみ対象
next unless [".hpp", ".h"].include?(File.extname(source))
#コピー先名はinclude/opencv2/module_name/header
module_name = File.split(source)[0].split("/").last
target = target_path+"include/opencv2/"+module_name
FileUtils.mkdir_p target unless File.exists? target
FileUtils.copy source, target
end
end
source_path = ARGV[0]
target_path = ARGV[1]
copy(source_path, target_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment