Last active
July 22, 2017 22:17
-
-
Save smcabrera/2a6709a1448ab6e0fd376775b1b46603 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/bin/env ruby | |
# frozen_string_literal: true | |
ARGV.each do |original_file| | |
unless File.exist? original_file | |
puts "#{original_file} does not exist" | |
next | |
end | |
timestamp = Time.now.utc.strftime("%Y%m%d%s") | |
file_parts = original_file.match(/(.*)\.(png|jpg)/) | |
new_file = "#{file_parts[1]}-#{timestamp}.#{file_parts[2]}" | |
puts "Changing #{original_file} to #{new_file}" | |
`mv #{original_file} #{new_file}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment