ExifTool Forum

ExifTool => Newbies => Topic started by: GoodKarma on June 02, 2023, 04:39:23 PM

Title: appending a tag to a filename
Post by: GoodKarma on June 02, 2023, 04:39:23 PM
Not used this in  while and having a brain fart, I am tryomg to appended xmp:sequence number to a folder, my command


exiftool '-FileName<${Filename}${XMP:SequenceNumber}' -ext jpg -r jpg

is appending the sequence number to the file extension, so

2023-05-22_11-47-05_Drone_1812_.jpg0 instead of 2023-05-22_11-47-05_Drone_1812_0.jpg

whta am i missing ?
Title: Re: appending a tag to a filename
Post by: StarGeek on June 04, 2023, 12:08:29 AM
The Filename tag includes the whole filename, including the extension.

Try using the percent variables detailed in the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut)
exiftool '-FileName<%f${XMP:SequenceNumber}.%e' -ext jpg -r /path/to/files/

Or you could use the BaseName tag, but you would still need to deal with the file extension
exiftool '-FileName<${BaseName}${XMP:SequenceNumber}.%e' -ext jpg -r /path/to/files/
Title: Re: appending a tag to a filename
Post by: GoodKarma on June 04, 2023, 05:50:42 AM
Quote from: StarGeek on June 04, 2023, 12:08:29 AMThe Filename tag includes the whole filename, including the extension.

Try using the percent variables detailed in the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut)
exiftool '-FileName<%f${XMP:SequenceNumber}.%e' -ext jpg -r /path/to/files/

Or you could use the BaseName tag, but you would still need to deal with the file extension
exiftool '-FileName<${BaseName}${XMP:SequenceNumber}.%e' -ext jpg -r /path/to/files/

thank you so much Stargeek, the first option worked a treat