ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Stephen Marsh on May 13, 2018, 09:29:12 PM

Title: Rename Files from CSV
Post by: Stephen Marsh on May 13, 2018, 09:29:12 PM
I have searched the site and found a lot of info on renaming files, but not from a CSV source.

I can easily update metadata such as keywords using a CSV source.

SourceFile,Subject
/path-to-file-folder/old1.jpg,Keyword-1
/path-to-file-folder/old2.jpg,Keyword-2


exiftool -sep ',' -csv='/path-to-file-folder/spreadsheet.csv' -ext jpg '/path-to-file-folder/'


However, what if I wanted to update the filename from a CSV source?

SourceFile,FileName
/path-to-file-folder/old1.jpg,new1.jpg
/path-to-file-folder/old2.jpg,new2.jpg


Does not work... I have also tried with a full absolute path to the new filename.

1 directories scanned
0 image files updated
2 image files unchanged

Title: Re: Rename Files from CSV
Post by: Phil Harvey on May 13, 2018, 10:01:37 PM
You're right:

            Empty values are ignored when importing (unless the -f option is
            used and the API MissingTagValue is set to an empty string, in
            which case the tag is deleted).  Also, FileName and Directory
            columns are ignored if they exist (ie. ExifTool will not attempt
            to write these tags with a CSV import).


This is a feature to prevent people from messing up their files unintentionally.

You'll have to do this some other way.

- Phil
Title: Re: Rename Files from CSV
Post by: Stephen Marsh on May 13, 2018, 10:04:40 PM
Thanks for the reply Phil, It is a shame. I even tried writing to a different directory so that the source files would be intact as I suspected that you may have built in safeguards...
Title: Re: Rename Files from CSV
Post by: colink on November 13, 2020, 11:59:42 AM
Just checking I understand Phil's earlier response.

Can someone confirm that it is not possible to use exiftool to rename files from a csv file.

I have read elsewhere where someone quotes Phil's answer above to explain that exiftool will not rename files form csv.
"This is a feature to prevent people from messing up their files unintentionally."

If I have understood correctly I hope Phil will not mind my comments.

Renaming files from a .CSV list would seem like something many people would want to do.

Column1 = existing path and filename
Column2 = new path and filename

If there was concern about screwing up files the command could, by default, copy the file leaving the original, but give the option of including -overwrite_original or similar when user is certain that their csv is correct.

For now I will work on the asumption that I cannto rename files usign csv.


Title: Re: Rename Files from CSV
Post by: StarGeek on November 13, 2020, 12:11:44 PM
Quote from: colink on November 13, 2020, 11:59:42 AM
Can someone confirm that it is not possible to use exiftool to rename files from a csv file.

It is confirmed in Phil's post above, which is taken from the docs on the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE).