How to insert exif:ImageDescription as addition to the FileName

Started by John Addis, August 15, 2022, 03:48:35 PM

Previous topic - Next topic

John Addis

My files are ordered by year and have been sequenced.
Most have data in the ImageDescription.

I would like to add the exif:ImageDescription  to the file name.
So the file 1999 JA_08400.jpg - one of many- would become
       file 1999 JA_08400_20 characters from exif.jpg

Files are stored on G:\PhotoMaster\Main\1999, so I would like to be able to add all files
under G:\PhotoMaster\Main\

I will copy G:\PhotoMaster\Main before running.  Updating should be in place.
That way the folders will be preserved.

IS it possible?  I can  not find where anyone has done it.
I have zero experience with exiftool.

John

StarGeek

Try this
exiftool "-TestName<%f $ImageDescription.%e" /path/to/files/

If the output looks correct, replace TestName with Filename to do the actual rename.

Files that don't have ImageDescription set will return an error and are skipped.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

John Addis

Dear StarGeek,

Sorry I did not get back to you sooner.  I thought I'd receive an email when someone answered.

I have tried, but to no avail
I used
exiftool "-TestName<%f $ImageDescription.%e" G:TEST/2001/"2001 JA_08760.jpg"
  had to put double quotes around my file name.
received
G:\TEST>exiftool "-TestName<%f $ImageDescription.%e" G:TEST/2001/"
2001 JA_08760.jpg"
Warning: Error opening file - G:TEST/2001/2001 JA_08760.jpg
Error: File not found - G:TEST/2001/2001 JA_08760.jpg
    0 image files updated

I wanted to process all files in this and other folders as one step.
Is it possibe?
What have I done wrong?  I do know nothing about exifTool!

John2022-08-16_204321.png2022-08-16_204820.png 

StarGeek

Quote from: John Addis on August 16, 2022, 09:07:20 PMSorry I did not get back to you sooner.  I thought I'd receive an email when someone answered.

Google, in their infinite wisdom  :P has decided that the simple SMTP process that this forum used to send email is no longer allowed.

Quoteexiftool "-TestName<%f $ImageDescription.%e" G:TEST/2001/"2001 JA_08760.jpg"
  had to put double quotes around my file name.

For whatever reason, exiftool can't find the file, thought the path looks correct.  Try putting quotes around the whole path and include the slash after the drive name
exiftool "-TestName<%f $ImageDescription.%e" "G:/TEST/2001/2001 JA_08760.jpg"

It doesn't matter whether you use forward or backward slashes in the file path because exiftool is written in Perl and Perl treats slashes in file paths the same.

Also, are you using CMD or PowerShell?  If the latter, use single quotes instead of double quotes.

If using CMD, you can also drag the file directly into the window to make sure the path is correct
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

John Addis

Hi StarGeek,

I am on Windows 10.  I have trouble keeping up with it, but I am 81 years old.

Finally figured that since I had download exiftool, that I should place it in the Windows folder, after taking the -K from the right side.

Then I copied your text into the CMD window and I think it worked.
But it didn't update.


But how do I get it to work and update for every file in all the folders under TEST?

Sorry that I am so dumb.

John


StarGeek

Did you change TestName into Filename after checking to see if the output listed the names correctly?
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

John Addis

No,  I put it in, but

I must need more parameters.

I want it to scan and update all of TEST/all folders

John2022-08-17_141434.png2022-08-17_141832.png 

StarGeek

Uh, why are you putting a file path to the left of the less than sign?  You put either TestName to see what the renames would be, or Filename to do the actual renaming.

The -r (-recurse) option will process subdirectories

First run this
exiftool -r "-TestName<%f $ImageDescription.%e" G:/TEST/2001
and look at the output to see if it is correct.  Then run this to do the actual renaming
exiftool -r "-Filename<%f $ImageDescription.%e" G:/TEST/2001
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

John Addis

StarGeek,

I found something that works
exiftool "-filename<%f $ImageDescription.%e" "G:/TEST/" dir -r

Is there another character than -r, to make EF scan sub-directories?
 
but the trouble is , if the ImageDesciption has a /, exiftool builds another directory.

The TEST folder had 3 folders 2017, 2018,2019.  I copied 3 files from 2017 and added the 3 same files to each folder.
The filename in error was 2017 JA_18720 John's flowers on 6/19/17.jpg, it started in folder 2017.

exiftool built a 2017 JA_ 18720 John's flowers on 6 directory, a 19 directory and moved the file into it, filename 17.jpg 2022-08-17_222205-small.jpg .
After the test the TEST folder had 4 folders.2022-08-17_222334-small.jpg2022-08-17_222432-small.jpg2022-08-17_222531-small.jpg2022-08-17_222622-small.jpg2022-08-17_222735-small.jpg2022-08-17_222847-small.jpg     

John Addis

I put a file path to the left of the less than sign, because I don't know what I am doing.

I am going to try the copy you sent a few minutes ago, at 2315 EDST

John Addis

Just tested exiftool -r "-TestName<%f $ImageDescription.%e" G:/TEST/2017

Changed 2001 since I am using some 2017 data.
Didn't work.  Nothing changed.  Maybe the -r goes on the right side?
Doesn't look like it tried the 2018 or 2019 folders.  That is why I used G:/TEST/ dir -r on the right side of the equation.
my test  exiftool "-filename<%f $ImageDescription.%e" "G:/TEST/" dir -r
  does dir make a difference?
2022-08-17_233919-medium.jpg

StarGeek

Quote from: John Addis on August 17, 2022, 11:29:07 PMI put a file path to the left of the less than sign, because I don't know what I am doing.

The text that is in a Monospace Brownish font is the exact command.  You would only replace the directory path where I put /path/to/files/ with the actual path you want to process

Quote from: John Addis on August 17, 2022, 11:18:40 PMIs there another character than -r, to make EF scan sub-directories?
 
but the trouble is , if the ImageDesciption has a /, exiftool builds another directory.

This is not a problem with -r, it's because of the slashes.  The position of the -r makes no difference.

The slash character is the part of Windows that indicates sub directories.  If there are slashes in the ImageDescription, they are telling exiftool to create subdirectories. 

Dealing with the slashes requires a slight change to the command. Braces and a semicolon need to be added to ImageDescription.  This will remove any special characters that Windows will treat differently
exiftool -r "-TestName<%f ${ImageDescription;}.%e" G:/TEST/2017
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

John Addis

I see the image-desc has changed to  ${ImageDescription;}.%e
with the {;}  added.
Does that take care of the /, ?, $, and ", that are contained in the ImageDescription field?

I have been spending a lot time removing those from the imageDescription.
I used exiftool to make a list of all descs in csv format.  using Excel to find.
working on 3rd pass now.

John

John Addis

StarGeek,

Thank YOU.

The ; takes out the special characters, but is there anything that replaces the special character  with a space?
So that John/Dick becomes John Dick, instead of JohnDick.

John Addis

I have quit saving my photo descriptions to ImageDescripion  about 5 years ago.
I now add the description to the end of the filename.
I would like to get the filename inserted in the ImageDescription, for those 5 years.

I have tried, but failed,  copied parts from things written.
exiftool -r -P -overwrite_original -wm cg -progress -"ImageDescription< "G:/TEST/" dir
When it is run, I get:  "No file specified".

Could you show me exactly, how to write the spec?
Then I can copy it.