Created
October 8, 2020 11:37
-
-
Save sherpc/6d71e16beee978e397a8e7caa6e0be37 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
Dir.foreach('.') do |filename| | |
next if filename == '.' or filename == '..' | |
# Do work on the remaining files & directories | |
r = /IMG_(.*?)_(.*?)[_\.].*/ | |
date_part = filename[r, 1] | |
time_part = filename[r, 2] | |
next unless date_part and time_part | |
d = date_part + time_part | |
d = d[0...-2] | |
v = `touch -mt #{d} '#{filename}'` | |
puts filename + ' => ' + d + ' => ' + v | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment