Skip to content

Instantly share code, notes, and snippets.

@closer
Created July 26, 2009 16:05
Show Gist options
  • Save closer/155840 to your computer and use it in GitHub Desktop.
Save closer/155840 to your computer and use it in GitHub Desktop.
#!/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