Skip to content

Instantly share code, notes, and snippets.

@Neurogami
Created April 15, 2015 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neurogami/e1b362229cd21a5e8d6a to your computer and use it in GitHub Desktop.
Save Neurogami/e1b362229cd21a5e8d6a to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.empty?
warn "Usage: #{__FILE__} <file-to-version>"
end
f = ARGV.first
_ = f.split '.'
ext = _.pop
new_f = "earlier_versions/#{_.join('.')}.#{Time.now.strftime '%Y-%m-%d_%H.%M.%S'}.#{ext}"
FileUtils.copy f, new_f
@Neurogami
Copy link
Author

Assumes you already have a local folder named "earlier_versions".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment