dotfiles/bin/executable_archive

14 lines
372 B
Plaintext
Raw Normal View History

2019-03-07 11:44:38 +01:00
#!/usr/bin/env ruby
require 'pathname'
require 'pry'
require 'fileutils'
source = Pathname.new(ARGV.join(" "))
target = File.join(source.dirname, (Time.now.strftime("%Y-%m-%d-") + source.basename.to_s + ".7z"))
2019-03-07 11:44:38 +01:00
system "7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on '#{target}' '#{source}'"
abort "Sorry, something went wrong" unless $?.eql? 0
2019-03-07 11:44:38 +01:00
FileUtils.rm_rf source