how to make additional filename mods using exiftool

Started by mTHdEzX6Ur, November 14, 2010, 04:47:36 PM

Previous topic - Next topic

mTHdEzX6Ur

How are additional filename modifications made using exiftool, without yielding either the concatenation of data to the modified filename string, or no mod at all made to filename string. Please note that I am using Ubuntu 10.04.

For example:

$ exiftool '-filename<${DateTimeOriginal}_Photographer_${Make}_${Model}_%f.%e' -d %Y-%m-%d *

-->

2003-09-07_Photographer_NIKON_E3100_dscn0182.jpg
2003-09-07_Photographer_NIKON_E3100_dscn0188.jpg
2003-09-11_Photographer_NIKON_E3100_dscn0200.jpg
                                   .
                                   .
                                   .

But

$exiftool '-filename<%f.%e' *

does not restore the original FileName, and in fact appears to make no changes to one or more filenames listed in the CWD/. that have been previously modified using an exiftool file renaming command.


Phil Harvey

I don't understand the question.  %f in the value written to the FileName tag represents the name of the file before the command was run.  It sounds like you want to take the last 8 characters of the file name, which you can do with %-8f.

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

mTHdEzX6Ur

#2
Question: If cmd  $ exiftool '-filename<${DateTimeOriginal}_Photographer_${Make}_${Model}_%f.%e' -d %Y-%m-%d *
can be used to batch modify the original filenames of digital photos put into a "landing" directory, converting series:

dscn0182.jpg
dscn0188.jpg
dscn0200.jpg
       .
       .
       .

into series:

2003-09-07_Photographer_NIKON_E3100_dscn0182.jpg
2003-09-07_Photographer_NIKON_E3100_dscn0188.jpg
2003-09-11_Photographer_NIKON_E3100_dscn0200.jpg
                                   .
                                   .
                                   .

What cmd will do the inverse, changing filename 2003-09-07_Photographer_NIKON_E3100_dscn0182.jpg --> dscn0182.jpg?

Note: After batch converting original filenames using the method described above, no changes are made when running the following cmd:
$ exiftool '-filename<%-8f.%e' *

Also, cmd
$ exiftool '-filename<${FileName}' *
does not change any of the filenames in the directory back to their original filenames.

Whereas cmd:
$ exiftool '-filename<${Make}' *
changes the filename of the first photo in the series to "NIKON", but does not batch convert the filenames to the desired format.
[Sample photos shot with an old Nikon 3100.]

Thus, IF the filename of a digital photo is modified such that it no longer contains the original file name, THEN how would exiftool be used to restore the original filename?
PROBLEM: MOD FILENAME = 2003-09-07_Paris AND ORIGINAL = dscn0182.jpg.
OBJECTIVE: Restore 2003-09-07_Paris --> dscn0182.jpg

Also, IF cmd
$ exiftool '-filename<${DateTimeOriginal}_Paris.%e' -d %Y-%m-%d *
is used to batch convert filenames of ORIGINAL format dscn9999.jpg --> 2003-09-07_Paris.jpg,
THEN
1) How is exiftool used to add the original filename to the modified 2003-09-07_Paris.jpg format to yield 2003-09-07_Paris_dscn9999.jpg ?
2) How would exiftool be used to batch modify filenames of format 2003-09-07_Paris.jpg to yield 2003-09-07_Paris_France.jpg ?

Phil Harvey

Quote from: mTHdEzX6Ur on November 16, 2010, 05:48:27 PM
What cmd will do the inverse, changing filename "2003-09-07_Photographer_NIKON_E3100_dscn0182.jpg" --> "dscn0182.jpg"?

Thanks for explaining.  If the new file name ends with 8 characters of the original file name, this will do what you want:

exiftool -filename=%-8f FILE

Here a simple assignment is used because you are not copying the value of any other tag.  The %d, %f, %e and %c are special codes when used anywhere that a file name is expected.

Quote
IF the filename of a digital photo is modified such that it no longer contains the original file name, how would exiftool be used to restore the original filename?

It is possible that the original file name exists somewhere in the file's metadata.  If so, you could copy that tag to the FileName.  Otherwise you are out of luck because exiftool is not magic, and can't pull information from thin air.

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

mTHdEzX6Ur

#4
Hi Phil-

Rest assured that I am under no illusion exiftool can perform magical feats of any kind! :)

What I didn't realize is that when renaming filenames using exiftool, the original EXIF filename was being changed. After making a filename change and running the cmd $ exiftool -s filexyz.jpg, I now see that that is the case.

Question: Is there an easy cmd for batch renaming the filenames of photos without changing the original EXIF filename data?

Thanks for your excellent support!

Phil Harvey

Quote from: mTHdEzX6Ur on November 17, 2010, 01:00:20 PM
Rest assured that under no circumstance am I under the impression that exiftool is magic!

*whew*

Quote
the original EXIF filename was being changed.

I think I see where the misunderstanding may have occurred... Perhaps you are confusing EXIF information with filesystem information.  Information shown under "System" when using the -g1 option is from the filesystem.  The FileName tag is taken from the filesystem, not from the EXIF.

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

mTHdEzX6Ur

Indeed, I must be confusing "Exif information with filesystem information". Have you provided a perspective on this topic on your web site?

Note: I will take some time tomorrow to explore the -gl option, and determine whether or not I can make some more sense of this.

Perhaps it's time to construct an "ExifTool for Dummys" guide aimed at non-programmers! Can I assist you with this process? . .

It would also be nice to see a GUI front-end for the Debian GNU/Linux platform.

Phil Harvey

Quote from: mTHdEzX6Ur on November 17, 2010, 02:12:03 PM
Have you provided a perspective on this topic on your web site?

There is no good overview, but you could explore the tag name documentation to gain insight.  Specifically, you will find the FileName tag in the Extra Tags documentation.

Quote
Note: I will take some time tomorrow to explore the -gl option

Note that it is -g1 (dash gee one), not -gl.  It is unfortunate that "1" and "l" (and "I" for that matter) are so similar in some fonts.

Quote
Perhaps it's time to construct an "ExifTool for Dummys" guide aimed at non-programmers! Can I assist you with this process? . .

I agree that this would be useful, but once you get more of a feel for the full range of exiftool features, you may see that this is a larger project than you think, hence the reason that nobody has tackled this yet.

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