Processing specific CSV columns only

Started by Martin Z, May 22, 2023, 07:47:53 PM

Previous topic - Next topic

Martin Z

Hi Phil, StarGeek, everyone -- another hopefully quite quick one from me...

Is there an option (i.e. syntax) to get EXIFtool to import/use a CSV file but only process specific columns in it?

Example 1:
- I have a CSV which has 10 column/tags for a set of files (one of which includes CreateDate)
- I want to set the Windows 'modified' and 'created' date to the value stored in the CreateDate column
- However, I don't EXIFtool to process the other columns / change any other metadata values

Example 2:
- I have the same 10-column CSV
- This time lets say I want to update the Category tag for each file with the value stored in the XPKeywords CSV column
- Again however, I don't want to change any other tags (including skipping over CreateDate this time)

Thanks in advance!

Martin Z

I may have made an obvious miss on this one. Would you just simply use TAG to do this...

EXIFTool -csv=Metadata.csv -TAG FileModifyDate -TAG FileCreateDate .

PS -- Sorry, haven't had any chance to test myself yet (busy with some other scripts and work I need to do, so just trying to collect info ahead of my next "EXIFtool spree"

StarGeek

Quote from: Martin Z on May 22, 2023, 07:47:53 PMIs there an option (i.e. syntax) to get EXIFtool to import/use a CSV file but only process specific columns in it?

No.  The -csv option is pretty much all or nothing.  Any copying/changing of tags would have to be done in the csv file directly.

Quote from: Martin Z on May 22, 2023, 11:47:30 PMEXIFTool -csv=Metadata.csv -TAG FileModifyDate -TAG FileCreateDate .

C:\>type temp.csv
SourceFile,FileCreateDate,FileModifyDate,Description
y:/!temp/Test4.jpg,2023:04:16 12:00:00-07:00,2022:05:17 12:00:00-07:00,New Description

C:\>exiftool -P -overwrite_original  -csv=temp.csv -TAG FileModifyDate -TAG FileCreateDate y:\!temp\Test4.jpg
Ignored superfluous tag names or invalid options: -TAG ...
No SourceFile 'FileModifyDate' in imported CSV database
No SourceFile 'FileCreateDate' in imported CSV database
    1 image files updated

-TAG is invalid option, and the tag names are treated as filenames, which leads to the no sourcefile warning.
"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

Martin Z

Hi StarGeek,

Thanks for getting back to me, and for confirming the situation.

While I totally appreciate that at the moment this is how EXIFtool behaves, I think this would be really useful function to add. I appreciate that you and Phil others may disagree, so have created a separate thread in the bug reports / feature requests area when this can be explored and discussed further.

Thanks again for your help on this one!

Phil Harvey

ExifTool 13.03 adds the ability to include or exclude specified columns from the CSV import, and 13.12 will expand this ability to allow group names and/or wildcards to be used when specifying which columns to import:

            Specific tags may be imported from the CSV database by adding -TAG
            options to the command, or excluded with --TAG, with exclusions
            taking priority.  Group names and wildcards are allowed.  If no
            tags are specified, then all except FileName and Directory are
            used.  Tags are imported in the same order as the database
            entries.


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