{"id":24,"date":"2008-03-26T11:13:22","date_gmt":"2008-03-26T11:13:22","guid":{"rendered":"http:\/\/haydnwilliams.com\/blog\/?p=44"},"modified":"2022-04-11T21:49:57","modified_gmt":"2022-04-11T20:49:57","slug":"edit-metadata-bash-scripts","status":"publish","type":"post","link":"https:\/\/www.haydnwilliams.com\/blog\/edit-metadata-bash-scripts\/","title":{"rendered":"Edit metadata &#8211; Bash scripts"},"content":{"rendered":"<p>I <a href=\"http:\/\/www.haydnwilliams.com\/blog\/editing-lightroom-metadata-using-exiftool\" title=\"HAYDN'S BLOG - Lightroom metadata with ExifTool\">recently wrote<\/a> about using <a href=\"http:\/\/www.sno.phy.queensu.ca\/~phil\/exiftool\/\" title=\"ExifTool by Phil Harvey\" target=\"_blank\" rel=\"noopener\">ExifTool<\/a> to edit the metadata stored within your images, particularly in relation to that information which is displayed in Lightroom. When I&#8217;m working with my images, I have a set of shell (BASH) scripts that I use to add or amend metadata, and I thought I&#8217;d make them available for other people to look at for inspiration, or even use if you find they meet your needs. For example, to add a title to the metadata of a specific image, I would run the following in a Terminal window:<\/p>\n<pre>$ img_title.sh &quot;This is my title.&quot; myphoto.jpg<\/pre>\n<p>To add the same title to all the images in a directory, I could type:<\/p>\n<pre>$ img_title.sh &quot;This is my title.&quot; -all<\/pre>\n<p>There are a couple of things to note when using the scripts:<\/p>\n<ol>\n<li>This is all done on a Mac. If you&#8217;re on Windows then I&#8217;m sorry. If you&#8217;re on Linux, I guess this should work, but I&#8217;ve not tried it.<\/li>\n<li>I&#8217;ve assumed that you&#8217;re comfortable running shell scripts in a Terminal; if you&#8217;re not happy doing this then I&#8217;d suggest you might be better either using Lightroom to manage your metadata, or investigating one of the graphical front ends for ExifTool.<\/li>\n<li>These scripts are designed specifically for my own  use; it&#8217;s highly unlikely that they&#8217;ll be perfect for what you need straight away. Feel free to modify them yourself if you want (but please keep the header, including my website URL, intact).<\/li>\n<li>The scripts don&#8217;t just add information to those fields which display in Lightroom, they add it to as many fields as is possible \/ relevant. For example, the <code>EXIF:XPTitle<\/code> field is not displayed anywhere in Lightroom, but the <code>img_title.sh<\/code> script still adds your title to that field anyway.<\/li>\n<li>You can get an example of how to run each script by just running it without passing any arguments at all. Further information about each script can be found in the header at the top of the file \u00a0(just view the file in Terminal, for example).<\/li>\n<li>To install the scripts, just unzip the downloaded file (see below for the link), and move the entire folder to <code>\/Library\/Scripts<\/code>. Then add the following line to your <code>~\/.bashrc<\/code> file:\u00a0\n<pre>PATH=$PATH:\/Library\/Scripts\/metadata<\/pre>\n<\/li>\n<\/ol>\n<p>You can download a zip file containing all the scripts\u00a0<a href=\"wp-content\/uploads\/2008\/03\/metadata.zip\" title=\"Download the shell scripts\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently wrote about using ExifTool to edit the metadata&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[63,98,196,291,296,334],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-photography","tag-command","tag-exiftool","tag-metadata","tag-script","tag-shell","tag-terminal"],"_links":{"self":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":0,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}