Macrium Reflect Free Edition and deleting old backup files

Update 16-Mar-10.  Forfiles command line updated to show @file instead of @path; testing and working.

Update 02-Aug-10.  Download location for ForFiles changed since Microsoft CodePlex page has been removed.

I needed a simple and free backup program for a single purpose PC that chugged along day in day out.  It ran Windows XP Professional and had a total used space of 8 GB on a 40 GB hard drive.  For convenience I installed a second 40 GB hard drive that would hold the backup files. Since it was always running the program would need to use the volume shadow service and be able to back up open files.

Macrium Reflect Free Edition fit the bill: it would create a single backup of the entire drive and came with a Linux boot restore CD that would allow full recovery. If you want incremental backup, RAID support, and a lot of other features then the full edition is the way to go.  It supports Windows XP up in 32 and 64 bit editions, is simple to use and set up and works very well.

Reflect Free

I set up a backup profile and scheduled a nightly backup and the next day everything was working wonderfully.  I promptly forgot about it and came back a month later to see my second hard drive had filled with backup files.  I started poking around the program but couldn’t find a setting to limit the number of backups created.  Since Macrium Reflect saves all it’s settings into an XML file I checked there and at the bottom found this:

<!– Disk Space Management –>
<dsm>
<!– Active Y – Yes, N – No –>
<active>N</active>
<!– Type 0 – Days, 1 – Weeks  –>
<type>0</type>
<!– Numbers of days or weeks –>
<number>10</number>
</dsm>
Perfect!  I changed Active to Y and the number of days to three then restarted Macrium Reflect.  Unfortunately I received an error indicating Disk Space Management was not supported in the free version.
I started searching for ways to delete files older than three days from a command line and soon came across a Microsoft tool called forfiles: it allows you to specify arguments for a certain set of files and then run a command on those files.  For me this means identifying the MRIMG backup files older than three days and deleting them.  Here’s the command:
forfiles /p “e:” /m “*.mrimg”  /d -3 /c “cmd /c del /Q @file”
I’m running forfiles on the e: folder looking for MRIMG files older than three days, then running the delete command on them.  Very simple and elegant.  Full syntax and lots of examples can be found a Microsoft TechNet.  I can see this is going to be an extremely handy utility.