Created
July 26, 2009 16:05
-
-
Save closer/155840 to your computer and use it in GitHub Desktop.
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
#!/usr/bun/ruby | |
require "fileutils" | |
require "pathname" | |
include FileUtils | |
SRC_BASE= Pathname.new ARGV.shift | |
DEST_BASE = Pathname.new ARGV.shift | |
def relative_path src | |
src.children.each do |child| | |
src_ = Pathname.new child | |
dest_ = DEST_BASE + src_.relative_path_from(SRC_BASE) | |
isfile = src_.file? | |
unless dest_.exist? | |
if isfile | |
begin | |
install src_, dest_ | |
rescue | |
retry | |
end | |
else | |
mkdir dest_ | |
end | |
print "C " | |
else | |
print "E " | |
end | |
puts src_ | |
relative_path src_ unless isfile | |
end | |
end | |
relative_path SRC_BASE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment