Author Topic: Renaming Tagged Files (Trying to run when I should be walking?)  (Read 1510 times)


  • Newbie
  • *
  • Posts: 1
I've just discovered the exiftool and have already used it with huge success, to sort out the clutter that was 4000+ photographs. They were taken on a camera which just numbered the images successively, but rolled over at 999. Hence, after a few rollovers... you get the picture (which I was having trouble doing, a lot of the time...). They are now renamed to the unique timedate they were taken, and sorted into a date tree file hierarchy. Brilliant!
But now, erm.. the tricky stuff. *Most* have a description tag. I'd like to be able to go through the entire directory tree and append each filename with something (say the letter T) if they have a description tag and don't already have a filename ending in T.

The next bit probably isn't an exiftool thing - but in case I can combine it with something else that exiftool is doing - I'd like to synchronise the main directory tree with a backup tree which has all the same photos, but each with a filename prefixed with the letter "B".

If anyone can steer me in the right direction as to how to do one or both of the above, it would be much appreciated!



Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: Renaming Tagged Files (Trying to run when I should be walking?)
« Reply #1 on: July 15, 2014, 08:17:42 AM »
Hi Sue,

Your first command could be:

exiftool -if "$description and $filename !~ /_T\./" "$filename<%f_T.%e" DIR

where DIR is the name of a directory containing the images.  (The above quoting is for Windows, use single quotes instead on Mac/Linux.)

ExifTool can't be used to synchronize two directories.  It can copy the files and add a "B_", but it can't be used to easily compare two files to see if one changed.

- 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 ($).

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1140
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: Renaming Tagged Files (Trying to run when I should be walking?)
« Reply #2 on: July 15, 2014, 10:10:19 AM »
Hi Sue,

To answer your second question. There are numerous tools to synchronise the content of two directories. Robocopy and rsync are two well known examples. To my knowledge, they all require your files to have the exact same name, though. So if you can live without the B in front, have a look at either of the tools I mentioned.

Hayo Baan – Photography