Last active
September 3, 2019 14:28
-
-
Save mikehale/541591d1af375f2d5e3b22bc90432b71 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
# To install this script as a context menu item, add this to the registry: | |
# key: \HKEY_CLASSES_ROOT\*\shell\Backup\command | |
# default data: C:\Ruby26-x64\bin\rubyw.exe C:\Scripts\backup.rb "%1" | |
# And place this file at C:\Scripts\backup.rb | |
require 'fileutils' | |
require 'time' | |
src = ARGV.first | |
exit unless src | |
src_extension = File.extname(src) | |
src_basename = File.basename(src, src_extension) | |
time = Time.now.utc.iso8601 | |
dest = "#{src_basename}_#{time}#{src_extension}" | |
FileUtils.cp(src, dest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment