<?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>Matt Shelton &#187; photos</title>
	<atom:link href="http://www.mattshelton.net/tags/photos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattshelton.net</link>
	<description>scribbling geekery, things and stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 13:38:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using Subversion to safeguard my photos</title>
		<link>http://www.mattshelton.net/2008/02/08/using-subversion-to-safeguard-my-photos/</link>
		<comments>http://www.mattshelton.net/2008/02/08/using-subversion-to-safeguard-my-photos/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 12:03:45 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[geek habits]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.mattshelton.net/2008/02/08/using-subversion-to-safeguard-my-photos/</guid>
		<description><![CDATA[<p>Posted in <a href="http://www.mattshelton.net/topics/code/" title="code">code</a><a href="http://www.mattshelton.net/topics/geek-habits/" title="geek habits">geek habits</a><a href="http://www.mattshelton.net/topics/how-to/" title="how-to">how-to</a></p>During the backup project, I created a subversion repository for all of my installation media and installation files &#8211; anything I&#8217;d need to set up a new computer. The intention was to have a system that was a solid backup &#8230; <a href="http://www.mattshelton.net/2008/02/08/using-subversion-to-safeguard-my-photos/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>During the backup project, I created a subversion repository for all of my installation media and installation files &#8211; anything I&#8217;d need to set up a new computer. The intention was to have a system that was a solid backup for these data, available for download from just about anywhere. Over the months, I&#8217;ve also added other stores to the repository, such as my <a href="http://www.mattshelton.net/2007/12/07/useful-tools/">useful windows standalone tools</a>.</p>
<p>Recently, I thought it would be useful to have all of my digital photos in the repository, both for backup purposes as well as to allow me to, say, have all of my downloaded desktop wallpapers on my machines at work and at home. What better purpose, right? The biggest pain was keeping the repository up to date without constantly needing to issue pseudo-random <code>svn add</code> commands every time we take pictures. (I could use <a href="http://scplugin.tigris.org/">scplugin</a> to make this easier, but <a href="http://www.mattshelton.net/2007/10/18/home-backup-project-part-3-subversion-clients/">as I found out</a>, it kinda sucks.)</p>
<p>Instead, I turned to my love for shell scripting, and fairly quickly banged this out. I used the handy <code>svn status</code> command with impunity to help me handle recursive adds and deletes. Of note, yes, I wish <a href="http://code.google.com/p/syntaxhighlighter/">SyntaxHighlighter</a> worked here&#8230;</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/sh

store='/Users/shelton/Pictures'
date=`date`
message=&quot;Auto-Commit on ${date}&quot;

# Update the local store
svn update ${store}

# Recursively delete all manually deleted files
svn status ${store} | sed -e '/^!/!d' -e 's/^!//' -e 's/^ *(.*)/1/' -e 's/ *$//' -e 's/ /\ /g' | xargs svn rm

# Recursively add all manually added files
svn status ${store} | sed -e '/^?/!d' -e 's/^?//' -e 's/^ *(.*)/1/' -e 's/ *$//' -e 's/ /\ /g' | xargs svn add

# Commit! Comment includes timestamp.
svn commit -m &quot;${message}&quot; ${store}

exit 0</pre>
<p><span style="text-decoration: line-through;">It would be really nice if there were <a href="http://code.google.com/p/syntaxhighlighter/">SyntaxHighlighter</a> support for shell scripts. Maybe that&#8217;s worth working on myself, eh?</span> <strong>Updated 2009-01-12:</strong> Sha-Zam!</p>
<p>This also required some modification to my <a href="http://www.nongnu.org/rdiff-backup/">rdiff-backup</a> cronjob since, well, I didn&#8217;t want to back up every single .svn directory and included files as that would effectively double the backup requirements for that directory. So, I played a bit more with rdiff-backup&#8217;s options and ended up changing from this:</p>
<p><code>45 04 * * * rdiff-backup -v5 --print-statistics --exclude /Users/shelton/rdiff-backup.log --include /Users/shelton/Documents --include /Users/shelton/Pictures --include /Users/shelton/Music --exclude '**' /Users/shelton /Volumes/backup/BACKUP &gt;&gt; /Users/shelton/rdiff-backup.log</code></p>
<p>to this:</p>
<p><code>rdiff-backup -v5 --print-statistics --include-globbing-filelist /Users/shelton/cfg/rdiff-backup-files.txt /Users/shelton /Volumes/backup/BACKUP &gt;&gt; /Users/shelton/logs/rdiff-backup.log</code></p>
<p>This is obviously MUCH cleaner. <code>rdiff-backup-files.txt</code> looks like this:<br />
- /Users/shelton/**/.svn<br />
- /Users/shelton/logs<br />
+ /Users/shelton/VM<br />
+ /Users/shelton/Documents<br />
+ /Users/shelton/Pictures<br />
+ /Users/shelton/Music<br />
+ /Users/shelton/Sites<br />
+ /Users/shelton/bin<br />
+ /Users/shelton/cfg<br />
+ /Users/shelton/.tcshrc<br />
+ /Users/shelton/.vimrc<br />
+ /Users/shelton/.crontab<br />
+ /Users/shelton/.ncftp<br />
+ /Users/shelton/.screenrc<br />
+ /Users/shelton/.htpasswd<br />
- **<br />
That first line, <code>- /Users/shelton/**/.svn</code>, is by far the most important, and took way too much trial and error to get right. Order of statements is, apparently, VERY important for rsync/rdiff-backup. Another note about the above list, I&#8217;m now backing up things that I wasn&#8217;t before, namely my VM directory, which contains my <a href="http://www.parallels.com/products/desktop/">Parallels</a> virtual machines. It started to make prudent sense, though currently the only VM in there is a very tiny cfg fileset to virtual-boot my <a href="http://www.apple.com/macosx/bootcamp/">BootCamp</a> partition. I&#8217;ve started doing several things differently with regard to my home backup, which I&#8217;ll have to summarize at some point soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattshelton.net/2008/02/08/using-subversion-to-safeguard-my-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

