{"id":680,"date":"2016-08-30T23:01:15","date_gmt":"2016-08-31T06:01:15","guid":{"rendered":"http:\/\/10.0.1.201\/?p=680"},"modified":"2016-08-30T23:01:15","modified_gmt":"2016-08-31T06:01:15","slug":"set-creation-and-modification-date","status":"publish","type":"post","link":"https:\/\/strawhousepig.net\/wordpress\/2016\/08\/30\/set-creation-and-modification-date\/","title":{"rendered":"Set creation and modification date"},"content":{"rendered":"<p>This is to correct file times on photos that were imported from cameras with bad date settings or when they have been transferred to-and-fro and picked up the wrong data some where <del datetime=\"2018-05-31T14:16:36+00:00\">or after re-encoding high bit rate video to save a few GBs.<\/del> [This does not alter the date atoms encoded in (most?) video files. <strong>ffmpeg<\/strong> can do that, however.]<br \/>\n<!--more--><\/p>\n<p><code>(*<br \/>\nhttp:\/\/strawhousepig.net\/<\/p>\n<p>This AppleScript utilizes Apple's command line developer tools command 'setfile' to set the modification date.<\/p>\n<p>https:\/\/developer.apple.com\/download\/more\/<\/p>\n<p>I believe an Apple Developer account is required for that, but I am not sure.<\/p>\n<p>*)<\/p>\n<p>set oldfile to choose file<br \/>\ntell application \"Finder\" to set filename to displayed name of oldfile<br \/>\nset newyear to text returned of (display dialog \"4 digit year\" with title filename default answer (do shell script \"date '+%Y'\"))<br \/>\nset newmonth to text returned of (display dialog \"2 digit month\" with title filename default answer (do shell script \"date '+%m'\"))<br \/>\nset newdate to text returned of (display dialog \"2 digit date\" with title filename default answer (do shell script \"date '+%d'\"))<br \/>\nset newtime to text returned of (display dialog \"24 hour time\" with title filename default answer \"0000\")<\/p>\n<p>try<br \/>\n\tdo shell script \"touch -t \" & newyear & newmonth & newdate & newtime & space & quoted form of POSIX path of oldfile<br \/>\non error theErr<br \/>\n\tdisplay dialog \"The 'touch' command said:\" & theErr<br \/>\nend try<br \/>\ntry<br \/>\n\tdo shell script \"setfile -d '\" & newmonth & \"\/\" & newdate & \"\/\" & newyear & \" \" & characters 1 through 2 of newtime & \":\" & characters 3 through 4 of newtime & \"' \" & quoted form of POSIX path of oldfile<br \/>\non error theErr<br \/>\n\tdisplay dialog \"The 'setfile' command said:\" & theErr<br \/>\nend try<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is to correct file times on photos that were imported from cameras with bad date settings or when they have been transferred to-and-fro and picked up the wrong data some where or after re-encoding high bit rate video to save a few GBs. [This does not alter the date atoms encoded in (most?) video [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[10,23,24,28],"class_list":["post-680","post","type-post","status-publish","format-standard","hentry","category-code","tag-applescript-2","tag-macintosh","tag-macos","tag-os-x"],"_links":{"self":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":0,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"wp:attachment":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}