<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pario TechnoBlob &#187; exiftags</title>
	<atom:link href="http://pario.no/tag/exiftags/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:17:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Shell scripts for archiving digital photos in directories by month</title>
		<link>http://pario.no/2007/05/15/199/</link>
		<comments>http://pario.no/2007/05/15/199/#comments</comments>
		<pubDate>Tue, 15 May 2007 07:01:16 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Photo etc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[exiftags]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[JPG]]></category>
		<category><![CDATA[metacam]]></category>
		<category><![CDATA[NEF]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/15/199/</guid>
		<description><![CDATA[This is my version of the shell script &#8220;Shell scripts for archiving digital photos in directories by date&#8220;. It utilizes the exiftags command available in most linux distributions like Gentoo and debian Linux. Though the metacam program is also usefull since it can read Nikon NEF-files. Here&#8217;s an example of a directory tree they create: [...]]]></description>
			<content:encoded><![CDATA[<p>This is my version of the shell script &#8220;<a href="http://pario.no/wordpress/2007/05/15/shell-scripts-for-archiving-digital-photos-in-directories-by-date/">Shell scripts for archiving digital photos in directories by date</a>&#8220;. It utilizes  the <strong>exiftags</strong> command available in most linux distributions like Gentoo and debian Linux. Though the <strong>metacam</strong> program is also usefull since it can read Nikon <strong>NEF</strong>-files.</p>
<p>Here&#8217;s an example of a directory tree they create:</p>
<pre>
2006
  2006-10
       IMG_48324.JPG
       IMG_48325.JPG
       IMG_48326.JPG
       IMG_48331.JPG
       IMG_48333.JPG
       IMG_48334.JPG
       IMG_48337.JPG
  2006-11
       IMG_48338.JPG
  ...etc...</pre>
<p><strong>move-digiphotos</strong><br />
This bash script (move-digifotos) scans EXIF tags from .JPG files in current directory with <a href="http://freshmeat.net/projects/metacam/">metacam</a>, creates necessary directories under <strong>$BASEDIR</strong> and moves the files in them:</p>
<pre>
#!/bin/bash

# Reads EXIF creation date from all .JPG files in the
# current directory and moves them carefully under
#
#   $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/
#
# ...where 'carefully' means that it does not overwrite
# differing files if they already exist and will not delete
# the original file if copying fails for some reason.
#
# It DOES overwrite identical files in the destination directory
# with the ones in current, however.
#
# This script was originally written and put into
# Public Domain by Jarno Elonen <elonen>; in June 2003.
# Feel free to do whatever you like with it.

BASEDIR=/home/backup/test

find -maxdepth 1 -name "*.JPG" | while read x; do
DATE=`exiftags "$x" | \
   egrep "^[ t]*Image Created:" | \
   sed -r "s/Image Created: ([0-9:]*).*/\1/"`
if [ ! -z "$DATE" ];
then
    YEAR=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\1/"`
    MONTH=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\2/"`
    if [ "$YEAR" -gt 0 ] &amp; [ "$MONTH" -gt 0 ]
    then
    INSTDIR=${BASEDIR}/${YEAR}/${YEAR}-${MONTH}
    install -d "$INSTDIR"
    INSTFILE="$INSTDIR/$x"
    if [ -e "$INSTFILE" ] &amp;&amp; ! cmp -s "$x" "$INSTFILE"
    then
        echo "WARNING: '$INSTFILE' exists already and is different from '$x'."
    else
        echo "Moving '$x'"
        cp -ax "$x" "$INSTFILE"
        if ! cmp -s "$x" "$INSTFILE"
        then
        echo "WARNING: copying failed somehow, will not delete original '$x'"
        else
        rm -f "$x"
        fi
    fi
    else
    echo "WARNING: '$x' doesn't contain date."
    fi
else
    echo "WARNING: '$x' doesn't contain date."
fi
done
</pre>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/freshmeat.net\/projects\/metacam\/"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMTUvMTk5Lzx3cHRiPlNoZWxsIHNjcmlwdHMgZm9yIGFyY2hpdmluZyBkaWdpdGFsIHBob3RvcyBpbiBkaXJlY3RvcmllcyBieSBtb250aDx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/15/199/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

