1 Reply Latest reply on Dec 10, 2016 11:16 AM by ec65692164

    How to change 'Date Created' field from a script?

    ec65692164

      Hi all,

       

      I suspect that during import, my 'Date Created' field got set to '0000-00-00T18:00:00+01:00' rather than the creation date of the picture. I have about 2000 pictures like that so I will not be setting them manually.

       

      I wrote a quick script in python to retrieve the Exif metadata but it seems that the 'Date Created' field is not part of Exif.

       

      What would you recommend I do to batch update the field to the correct date? I can reference the file name which contains date/time or the Exif metadata.

       

      I know there is an SDK, but I have no experience in Lua and no idea if it can even help me for such a job.

       

      Thank you for any help you can provide!

        • 1. Re: How to change 'Date Created' field from a script?
          ec65692164 Level 1

          If you post a question, chances are you'll figure out the answer five minutes later... as I just have.

           

          Find the field:

          $ strings 2015-03-14_15-47-43_89287.CR2|grep 'photoshop:DateCreated'

                  <photoshop:DateCreated>0000-00-00T18:00:00+01:00</photoshop:DateCreated>

                  <photoshop:DateCreated>0000-00-00T18:00:00+01:00</photoshop:DateCreated>

           

          fix it quickly:

          $ time LC_ALL=C sed -i.bkup 's/0000-00-00T18:00:00+01:00/2015-03-14T15:47:43+01:00/g' 2015-03-14_15-47-43_89287.CR2

           

          real    0m0.265s

          user    0m0.183s

          sys    0m0.042s

           

          check it:

          $ strings 2015-03-14_15-47-43_89287.CR2|grep 'photoshop:DateCreated'

                  <photoshop:DateCreated>2015-03-14T15:47:43+01:00</photoshop:DateCreated>

                  <photoshop:DateCreated>2015-03-14T15:47:43+01:00</photoshop:DateCreated>

           

          You now have a backup of the original file and an updated RAW file in under a second. Wrap a basic shell script around it and you are done.

           

          I hope this will help someone.