ExifTool Forum

ExifTool => Newbies => Topic started by: Hbar on August 17, 2016, 01:22:59 PM

Title: Destination File in CSV import
Post by: Hbar on August 17, 2016, 01:22:59 PM
Hello,

I am creating an excel tool to reorganise collections of scans using vba and exiftool. In my managed to get my program working with csv files to export and import tags.

The purpose is to completely reorganise my collections of many tenthousands of scans (all cadaster maps from 1842 onwards for Belgium and Dutch Limburg). This involves creating tags and renaming files, using serveral look-up tables. For the latter I am using Excel: I read tags from the existing files in one Excel table and from this I create a second table with the new tags ,the new filenames and a completely different directory structure.
This all works great with exiftool and Excel, except that I am looking for an efficient way to rename the files.

In the csv files there is the SourceFile, but I am looking for a DestinationFile in vane. Am I missing something? Without this, the processing would be tedious: copying and rename the files, add the tags and delete the "TIFF_original"s, involving TBytes.

Any suggestions?
Title: Re: Destination File in CSV import
Post by: Phil Harvey on August 17, 2016, 03:05:09 PM
I think that reading FAQ 12 (https://exiftool.org/faq.html#Q12) may help here.

- Phil
Title: Re: Destination File in CSV import
Post by: Hbar on August 19, 2016, 05:40:27 PM
Sorry Phil,

I might not understand the depth of FAQ 12, but I have no problem to export the information into a database (in my case Excel) nor to import the information from the database (FAQ 26).

My problem lies in the fact that I would like to import AND RENAME the image files. I have seen simple rename capabilities e.g. with %Y and %M but this is not sufficient for me. What I am looking for is something like a DestinationFile in the csv, similar like the SourceFile.

I tried to clarify this in the attachement.

Hope you can help.

Best regard
Harrie Bär
Title: Re: Destination File in CSV import
Post by: StarGeek on August 19, 2016, 07:42:35 PM
From the docs (http://www.exiftool.org/exiftool_pod.html#csv_csvfile):
"FileName and Directory columns are ignored if they exist"

So you can't rename directly from a CSV.  The question becomes how complicated is the formula that you use to create the destination name.  It could be possible to create the destination filename either through the advanced formatting or a user defined tag if it could be based upon info that's already in the file.  Remember, you have the full power of the Perl language available.

But I think the easier answer would be a two step solution.  First, write the DestinationFile into a tag you don't use, along with all your other tags from the CSV.  Title would be a good example, as I believe that is normally the place you would write the file name.  Then, you could rename all the files by using exiftool "-filename<Title" DIR.  You could then clear out the Title if you like.
Title: Re: Destination File in CSV import
Post by: Hbar on August 22, 2016, 04:15:46 PM
Thank you very much for the suggestion.

It is a pity it cannot be done in the CSV as it would be far more efficient. But no problem, I will then use vba in Excel to do the job.

Thanks again for your quick help.

Best regards,
Harrie Bär