<?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>Logaan's Site &#187; batch scripting</title>
	<atom:link href="http://www.logaans-site.co.uk/tag/batch-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logaans-site.co.uk</link>
	<description>In my own little world, world...world</description>
	<lastBuildDate>Wed, 01 Sep 2010 13:43:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simpler version of the 7-Zip backup</title>
		<link>http://www.logaans-site.co.uk/2009/10/17/simpler-version-of-the-7-zip-backup/</link>
		<comments>http://www.logaans-site.co.uk/2009/10/17/simpler-version-of-the-7-zip-backup/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 00:16:38 +0000</pubDate>
		<dc:creator>Logaan</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[batch scripting]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.logaans-site.co.uk/?p=494</guid>
		<description><![CDATA[I have tested the 7-Zip backup I had constructured that I posted about a while back and I have come to realise that it is a tad bit too complicated. I even went through the process of creating a proxy application to try and get it to be a bit more cleverer but in the [...]]]></description>
			<content:encoded><![CDATA[<p>I have tested the 7-Zip backup I had constructured that I posted about a while back and I have come to realise that it is a tad bit too complicated. I even went through the process of creating a proxy application to try and get it to be a bit more cleverer but in the end I simplified it down to just 4 parts; the logic, settings and file lists.</p>
<p><strong>Backup.cmd</strong></p>
<pre class="brush: plain; auto-links: false;">
@ECHO OFF

ECHO 7-Zip backup script
ECHO Written by Alex Boyne-Aitken
ECHO Last update: 07/11/2009
ECHO.

ECHO TRACE: Parse arguments: '%~f1'
IF EXIST %~f1 GOTO labelBegin

ECHO.
ECHO ERROR: Settings file not found!
GOTO labelWaitEnd

:labelBegin

ECHO.
ECHO TRACE: Reading settings
FOR /F &quot;eol=# tokens=1,2 delims==&quot; %%i IN (%~f1) DO (
SET %%i=%%j
ECHO TRACE: %%i = '%%j'
)

SET varTimeStamp=%DATE:~-4%-%DATE:~3,2%-%DATE:~0,2%-%TIME:~0,2%-%TIME:~3,2%
SET varTargetBackupSet=%varBackupPath%\%varTimeStamp%-backup.zip

ECHO.
ECHO TRACE: Backup set: '%varTargetBackupSet%'
ECHO TRACE: Command line: '&quot;%varPathToSevenZip%\7z&quot; a -t%varArchiveType% &quot;%varTargetBackupSet%&quot; @&quot;%varInclusionsFile%&quot; -xr@&quot;%varExclusionsFile%&quot;'

ECHO.
ECHO TRACE: Executing backup
&quot;%varPathToSevenZip%\7z&quot; a -t%varArchiveType% &quot;%varTargetBackupSet%&quot; @&quot;%varInclusionsFile%&quot; -xr@&quot;%varExclusionsFile%&quot;

IF /I NOT &quot;%varWaitAtEnd%&quot; == &quot;true&quot; GOTO labelEnd

:labelWaitEnd
PAUSE
:labelEnd
</pre>
<p><strong>Settings.txt</strong></p>
<pre class="brush: plain; auto-links: false;">
# The path to the where the 7z.exe executable is
varPathToSevenZip=C:\Program Files\7-Zip

# The path where to store the backup sets
varBackupPath=D:\Backups

# The file path to the inclusions file
varInclusionsFile=D:\Logaan\Documents\Tools\7ZipBackup\Settings\Inclusions.txt

# The file path to the exclusions file
varExclusionsFile=D:\Logaan\Documents\Tools\7ZipBackup\Settings\Exclusions.txt

# Whether to wait at the end of the backup
varWaitAtEnd=true

# Type of backup archive to create
varArchiveType=zip
</pre>
<p><strong>Exclusions.txt</strong></p>
<pre class="brush: plain; auto-links: false;">
*.svn
</pre>
<p><strong>Inclusions.txt</strong></p>
<pre class="brush: plain; auto-links: false;">
D:\Logaan\Documents
D:\Logaan\Favorites
C:\Users\Logaan\Desktop
D:\Logaan\Saved Games
</pre>
<p><strong>How to use it</strong></p>
<p>Place the batch file and settings files in a folder somewhere.</p>
<p>Update the setttings file with the correct paths.</p>
<p>Pass the path to the settings file to the backup batch file.</p>
<pre class="brush: plain; auto-links: false;">
C:&gt; backup D:\Logaan\Documents\Backup\settings.txt
</pre>
<p>Or create a scheduled task.</p>
<p><a href="http://www.logaans-site.co.uk/wp-content/uploads/2009/10/EditAction.png"><img class="aligncenter size-full wp-image-519" title="Edit Action" src="http://www.logaans-site.co.uk/wp-content/uploads/2009/10/EditAction.png" alt="Edit Action" width="468" height="504" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.logaans-site.co.uk/2009/10/17/simpler-version-of-the-7-zip-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
