Created
June 30, 2015 06:49
-
-
Save c0ze/a21e98018299b51b275c to your computer and use it in GitHub Desktop.
A gist to unzip photos packed by google takeout and put them into folders by date
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
require 'zip' | |
file_path = ARGV[0] | |
Zip::ZipFile.open(file_path) { |zip_file| | |
zip_file.each { |f| | |
date = f.name.split("/")[2].split(" ")[0] | |
name = f.name.split("/")[3] | |
p "date #{date} name #{name}" | |
f_path=File.join("GooglePhotos", date.split("-"), name) | |
FileUtils.mkdir_p(File.dirname(f_path)) | |
zip_file.extract(f, f_path) unless File.exist?(f_path) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment