Author Topic: Renaming photos with date and title  (Read 1548 times)

krzysiu

  • Jr. Member
  • **
  • Posts: 21
    • krzysiu.net
Renaming photos with date and title
« on: August 10, 2017, 11:49:39 AM »
Hey! I'm not really a newbie. I know it sounds "do the job for me", but the point is I have worse day, I can't concentrate at all and I'd love to send some photos for people who asked for it. I'm simply not able to understand simplest things, so I'm asking you for exact command. I have JPEG photos (from CR2, but most metadata is kept) and I'd like to rename them in following format:
[yyyy-mm1-dd hhhmm2m] Photo title.jpg
1 month
2 minutes

The h and m means literal letters, so the name I'd want to achieve is e.g. [2017-08-02 22h15m] Spider that scared me to death.jpg (really it did - it was so called wasp spider)

So now there are things that you should know:
  • I'm Windows user. I know about unicode stuff, so to make it simpler, I resign from diacritics, i.e. code page wouldn't matter at all - I'll use just Latin letters
  • I'd love to do it in the batch file (the eventual loops etc. would be up to me, I'm just asking about exiftool paramteres)
  • These are JPEGs from CR2 so if something would go wrong, nothing bad will happen

And my questions:
  • What would be the best place to store title? JPEG comment? Something in IPTC? XMP? I would write some app that would add titles quickly, but I'd have to know where to save it.
  • Basing on above recommendation, could you give me an exact command which could be put in batch file (there are some issues between command line % and batch files) which would rename it?

Sorry, I know you can find it in the Internet, but I'm really out of my mind and playing with my photos, makes me better :( I tried, I failed.

I promise to post even more tutorials to thank you. For now I did some crappy application (only for Windows and can break any time if Phil would use different HTML format), which could serve as "thank you" (I'll post it in different topic soon). There it is: https://github.com/Krzysiu/exifNeatHTML

But as I'm a programmer I can help you with some things. Or I can add you to thanks section of my photo gallery with link to website. Again sorry for asking question probably answered 100 times.
« Last Edit: August 10, 2017, 12:06:59 PM by krzysiu »
"We would use teleporters and live on another planets, if only ExifTool would be present when I was researching cosmos and physics"
Albert Einstein

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15707
    • ExifTool Home Page
Re: Renaming photos with date and title
« Reply #1 on: August 10, 2017, 12:15:51 PM »
You could put the title in XMP:Title (the default location for the "Title" tag):

exiftool -title="some title" FILE

And to rename as you desire:

exiftool "-filename<${createdate} ${title;}.%e" -d "[%Y-%m-%d %Hh%mm]" DIR

This should work assuming CreateDate exists.  If it doesn't, you can add fallbacks in reverse order of priority, eg:

exiftool "-filename<${filemodifydate} ${title;}.%e" "-filename<${datetimeoriginal} ${title;}.%e" "-filename<${createdate} ${title;}.%e" -d "[%Y-%m-%d %Hh%mm]" DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).