{"id":953,"date":"2020-12-22T02:14:45","date_gmt":"2020-12-22T07:14:45","guid":{"rendered":"https:\/\/dc540.org\/xxx\/?p=953"},"modified":"2020-12-22T02:14:46","modified_gmt":"2020-12-22T07:14:46","slug":"migrating-yuuuge-photo-galleries-exiftool-ftw","status":"publish","type":"post","link":"https:\/\/dc540.org\/xxx\/2020\/12\/migrating-yuuuge-photo-galleries-exiftool-ftw\/","title":{"rendered":"Migrating YUUUGE photo galleries: exiftool FTW"},"content":{"rendered":"\n<p>Years back, I hosted several large photo galleries on a public website. Password-protected, but my family was the only consumer of the data anyway. <\/p>\n\n\n\n<p>I decided to migrate that to my growing internal network, because I have disk space, backups, and faster networking. Plus that old gallery software was getting long in the tooth and I didn&#8217;t feel like continuing to maintain it.<\/p>\n\n\n\n<p>Dilemma: The old gallery was one of those, like most of them, that import the files, give them a long filename and remove the uploaded copy. So there was no rhyme or reason to the 11G of photos on that server, just a single flat gigantic directory of JPG files, over 1500 of them in total.<\/p>\n\n\n\n<p>It only took a few minutes to realize that there seemed to be three paths &#8212; (1) a fully manual path of uploading all of the files in a batch into the new photo management app (I&#8217;m using Lychee, by the way) and then sorting through them; (2) a less manual, but still involved, path of logging into the old gallery and exporting\/downloading each set; or (3) finding a smarter way.<\/p>\n\n\n\n<p>I chose (3) finding a smarter way. I realized that my photo sets were all event-based, and the date of those events are stored in the EXIF data of each individual photo file. So I wondered if there was an easy way to extract that in a useful way, and then possibly script it to segregated it by date. I quickly found something even better &#8212; the exiftool itself (installed on my macbook with Homebrew) will easily do exactly that:<\/p>\n\n\n\n<p><code>exiftool '-Directory&lt;DateTimeOriginal' -d %Y-%m-%d \"$dir\"<\/code><\/p>\n\n\n\n<p>Will siphon through an entire directory, lickety-split, pull out the capture date from the EXIF data, and then file them in a directory named for the YYYY-MM-DD of the date. It will even create the directories if they don&#8217;t exist. I went in seconds from a flat directory of over 1500 files to, let&#8217;s see&#8230;. 12 individual date directories, each filled with a day of photos.<\/p>\n\n\n\n<p>Lychee lets me import directories and will name them &#8220;[IMPORT] (directory name)&#8221; so all I have to do once they&#8217;re all imported is to log into Lychee, look into each newly-imported directory to figure out what the event was, and rename the album. Fun stuff.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Years back, I hosted several large photo galleries on a public website. Password-protected, but my family was the only consumer of the data anyway. I decided to migrate that to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/dc540.org\/xxx\/2020\/12\/migrating-yuuuge-photo-galleries-exiftool-ftw\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Migrating YUUUGE photo galleries: exiftool FTW&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":954,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[70,1],"tags":[],"class_list":["post-953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-fu","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dc540.org\/xxx\/wp-content\/uploads\/2020\/12\/a700.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts\/953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/comments?post=953"}],"version-history":[{"count":1,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts\/953\/revisions"}],"predecessor-version":[{"id":955,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/posts\/953\/revisions\/955"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/media\/954"}],"wp:attachment":[{"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/media?parent=953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/categories?post=953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dc540.org\/xxx\/wp-json\/wp\/v2\/tags?post=953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}