<?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>databasically // Kansas City Small Business IT &#38;&#38; Ruby on Rails Programming &#187; System</title>
	<atom:link href="http://databasically.com/category/blog/programming/system/feed/" rel="self" type="application/rss+xml" />
	<link>http://databasically.com</link>
	<description>Kansas City Small Business IT</description>
	<lastBuildDate>Tue, 20 Jul 2010 21:35:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Deleting old files</title>
		<link>http://databasically.com/2008/06/01/deleting-old-files/</link>
		<comments>http://databasically.com/2008/06/01/deleting-old-files/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 04:48:18 +0000</pubDate>
		<dc:creator>Wes</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.databasically.com/?p=6</guid>
		<description><![CDATA[Oftentimes, I like to backup SQL databases to a local folder, then include that folder in my backup to tape/disk/network.  That way, the backup software doesn&#8217;t have to be database aware; it&#8217;s just backing up files.
SQL Server allows you to schedule backups and there&#8217;s an option to clear out the old backup files, but [...]]]></description>
			<content:encoded><![CDATA[<p>Oftentimes, I like to backup SQL databases to a local folder, then include that folder in my backup to tape/disk/network.  That way, the backup software doesn&#8217;t have to be database aware; it&#8217;s just backing up files.</p>
<p>SQL Server allows you to schedule backups and there&#8217;s an option to clear out the old backup files, but I&#8217;ve found it doesn&#8217;t always work quite right.  I&#8217;d always struggled with a way to do this until I found the FORFILES command.</p>
<p>Now, I&#8217;m not sure what version of Windows this appeared it, but I know it&#8217;s in Windows Server 2003.</p>
<p>
<pre name="code" lang="vb">forfiles /p e:\backup /m *.bak /d -2 /c "cmd /c del @file"</pre>
</p>
<p>The /c option allows you to run any command, so I&#8217;m using the del command to delete all files older than a certain date.  Certainly, you could do whatever you want, like move them or copy or print their attributes.</p>
<p>The /d is where you specify a date or a number of days. A plus gives you files after that date and a minus gives you files before that date.  In my example, files more that two days old are selected to be deleted.</p>
<p>I never had a good way to do this before, so I was always resorting to a script written in another language or a customized batch file (and batch programming is not fun!)</p>
]]></content:encoded>
			<wfw:commentRss>http://databasically.com/2008/06/01/deleting-old-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
