Author Topic: Batch Import Metadata from CSV as a template  (Read 167 times)

rainerzufahl

  • Newbie
  • *
  • Posts: 3
Batch Import Metadata from CSV as a template
« on: June 30, 2020, 04:23:08 AM »
Hello guys,

I have a non-electronic prime lens, and I want to write the lenses metadata to all images taken with that lens. This includes tags like LensInfo, Aperture, FocalLength and so on.

I have already generated a .csv from a different lens and changed the values I need. What I now struggle with is importing this set of data, that is the same for all images processed, to all the images. When using comands like
Code: [Select]
exiftool -r -overwrite_original -csv="path/to/csv" "path/to/images"give back the error
Code: [Select]
No source file foundwhich makes sense because the data isn't bound to any specific file, and I didn't create a "SourceFile" Column.

I hope I've explained this problem well enough, but let me know if you need any further information. I'd love to get this thing working!

Thanks so much for your help,
Rainer

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16706
    • ExifTool Home Page
Re: Batch Import Metadata from CSV as a template
« Reply #1 on: June 30, 2020, 05:27:36 AM »
Hi Rainer,

Create a SourceFile column and put a "*" in it.

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

rainerzufahl

  • Newbie
  • *
  • Posts: 3
Re: Batch Import Metadata from CSV as a template
« Reply #2 on: June 30, 2020, 11:54:06 AM »
Hello Phil, thank you for the fast respone!

After some testing, that solution works. But I've run into a new issue now:

I want to use the Windows executable that I can drop files onto to process. The current name of that executable is:
exiftool(-k -r -overwrite_original -csv=Metadata_Helios.csv).exe
When the images I drop on that exe are in the same folder as the exe, this works fine. But when dropping files from other folders, the "No SourceFile" error pops up.

As I want to be able to batch process images after shooting with the manual lens, I wouldn't want to copy all the images to the exe, process them, then copy them back. Is there any way to solve this?

Again, thanks so much for your help.

Rainer

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16706
    • ExifTool Home Page
Re: Batch Import Metadata from CSV as a template
« Reply #3 on: June 30, 2020, 12:12:03 PM »
Hi Rainer,

I suspect that the proper Metadata_Helios.csv file is not being loaded.  Unfortunately you can't put the full pathname in the brackets of the .exe file, so either a shortcut or a .bat file is the solution.

For the .bat file:

c:/path/to/exiftool/exiftool.exe -k -r -overwrite_original -csv=c:/path/to/csvfile/Metadata_Helios.csv %*

Then drop the files on the .bat file.

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

rainerzufahl

  • Newbie
  • *
  • Posts: 3
Re: Batch Import Metadata from CSV as a template
« Reply #4 on: June 30, 2020, 12:34:50 PM »
This solution works! While it is a bummer that the console windows doesn't show any progress, I'm still very happy.

Out of interest, what's the "%*" at the end of the bat command doing?

Rainer

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3795
Re: Batch Import Metadata from CSV as a template
« Reply #5 on: June 30, 2020, 03:05:25 PM »
What does %* mean in a batch file?
It means "all the parameters in the command line".

It's basically all the filenames you drop onto the bat file.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16706
    • ExifTool Home Page
Re: Batch Import Metadata from CSV as a template
« Reply #6 on: June 30, 2020, 03:08:43 PM »
Hi Rainer,

Add -progress to the command to show progress.  There are various features available with the -progress option that are described in the documentation.

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