• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Dec 10, 2016 Dec 10, 2016

Copy link to clipboard

Copied

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!

Views

424

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

New Here , Dec 10, 2016 Dec 10, 2016

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    0

...

Votes

Translate

Translate
New Here ,
Dec 10, 2016 Dec 10, 2016

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines