Is it possible to rename files by appending a tags values to orig filename?

Started by Archive, May 12, 2010, 08:53:56 AM

Previous topic - Next topic

Archive

[Originally posted by mhale on 2006-09-23 02:58:14-07]

I a new exiftool user and I'm looking for a way to append a tag to a filename. Examples would be to append the compression to a tif file so bob.tif becomes bob_lzw.tif or or Photoshops jpeg quality so bob.jpg becomes bob_8.jpg.

All the rename examples I can find use date and doesn't retain any of the orig filename.

Mike

Archive

[Originally posted by exiftool on 2006-09-23 13:58:23-07]

This feature request has come up often enough that I thought I should finally do something about it:

ExifTool would very nearly do what you want, the only problem was that the FileName tag contains
the extension, which makes changing only the base name difficult.  To solve this, I have added two composite
tags: BaseName and Extension.  These tags allow you to get a handle on the separate parts
of the filename, allowing you to do what you want like this:

Code:
   exiftool '-filename<${basename}_${compression}.$extension' -ext tiff DIR

This feature will appear in version 6.43, and I have uploaded a
6.43 pre-release
for you to test out if you want something to play with until the official version is released.

- Phil

Archive

[Originally posted by mhale on 2006-09-23 23:45:04-07]

Thanks for your reply and for adding the new tags.

After making my post, I re-read the docs and some posts in this forum. That along with some trial and error let me come up with something very much like your line.

Code:
exiftool.pl "-filename<%f_${compression}.%e" c:\temp -ext tif

Which works great for tif files. With jpeg files and PhotoshopQuality it would be nice if it didn't rename the file if there isn't a Photoshop tag but I can live with it.

I'm the admin for a forum on scripting Photoshop. After I have enough examples I plan on posting a tutorial on using Exiftool and how to call it from a javascript. If you like I can send you an email when it's posted.

Thanks again for your reply and for your great program,

Mike

Archive

[Originally posted by exiftool on 2006-09-24 23:58:07-07]

Wow, you learn something every day.  Smiley

Thanks for pointing this out!  I didn't even realize (or had forgotten) that this would work.
LOL... You know my software better than I do!  I'll add this to the documentation, and
remove the BaseName and Extension tags.

I see how it could be annoying to set the filename to "FILE_-.jpg" when there is no
PhotoshopQuality tag.  I will think about this.

Sure, send me an email with your URL once you are done your documentation.

Thanks.

- Phil

Archive

[Originally posted by exiftool on 2006-09-25 13:58:44-07]

I've made a few changes to the
6.43 pre-release:

The BaseName and Extension tags have now been relegated to the UserDefined tags in the sample
ExifTool_config file for those who find them useful.  Also, I have changed the behaviour so that a
minor warning is issued if a tag used in an expression isn't available.  So now, your file won't get
renamed unless PhotoshopQuality exists.  (However, using the -m option will ignore the warning
and revert to the previous behaviour of substituting a "-" for missing tags.)

I think these changes should work well for most people, but please let me know if anyone has any
problems with them.  Thanks.

- Phil

Archive

[Originally posted by mhale on 2006-09-26 00:45:44-07]

Thanks for the expression behavior change. I could clean-up the filenames later but it's nice now that I don't need to.

I have some questions about unknown tags. As a photoshop scripter, I would like access to some of the unknown photoshop tags. I read in this forum that one can access unknown tags by the tag number. I have tried many variations using both the tag name and the hex and dec numbers and havn't been able to come up with the correct systax. Can you post an example, say using ClippingPathName?

Is there a way to output only the unknown tags? And can I redefine some of those tags as user-defined tags in the conf file?

The more I work with ExifTool, the more impressed I am by how powerful it is. It doesn't supprise me that even it's author can't remember everthing it can do.

Thanks again,

Mike

Archive

[Originally posted by exiftool on 2006-09-26 11:32:47-07]

Hi Mike,

Use the "-u -s" options to see the unknown tags and their associated tag names.  Note that some 'unknown' tags actually have tag names, and these tags can not be referred to by a hex number.  Each value has only one tag name which can be used to access the information.

There is no way to output only the unknown tags.  But yes, you can re-define any of the Photoshop tags.

I know what you mean.  Without my ExifTool documentation, I'd be lost... Wink

- Phil