Archive for the ‘Tutorials’ Category

Simple batch file backup

Saturday, August 18th, 2007

I’ve just setup a very simple backup system that works over FTP. Windows only I’m afraid but i’m sure the equivilent isn’t too hard on other platforms.

Tools
Firstly I used two very simple free/open source command line tools:
SSLFTP - simple FTP tool that works in passive mode or over secure connections.
and
7-zip - an open source zip file archiver.

Download and install the above on the machine you wish to backup from.

FTP Script
I then wrote the following script file to handle the FTP (saved as ftpscript.txt):

open ftpusername:ftppassword@ftp.host.address
del backup7.zip
rename backup6.zip backup7.zip
rename backup5.zip backup6.zip
rename backup4.zip backup5.zip
rename backup3.zip backup4.zip
rename backup2.zip backup3.zip
rename backup.zip backup2.zip
put c:\backupscripts\backup.zip
bye

All this is doing is taking a copy of seven days worth of backups and deleting the oldest then uploading the newest backup.

Backup Script
To decrease the time taken to FTP everything I use the following batch file to keep three days worth of backups locally, zip the files I want to backup and call the above FTP script (saved as daily.bat):

delete backup3.zip
rename backup2.zip backup3.zip
rename backup.zip backup2.zip
7z a -tzip d:\backupscripts\backup.zip d:\inetpub\wwwroot\
7z a -tzip d:\backupscripts\backup.zip d:\DB_Backup\
7z a -tzip d:\backupscripts\backup.zip d:\other_folders_to_keep\
sslftp -run ftpscript.txt

The 7z lines mean the following:
7z - execute the 7-zip exe
a - add files
-tzip - archive file type of zip
d:\backupscripts\backup.zip - archive to add to (will create if does not exist)
d:\backupscripts\backup.zip d:\other_folders_to_keep\ folder/files to add to archive

And thats it! All you do then is setup a scheduled task (Start, Settings, Control Panel, Scheduled Tasks) to run every night and you’re done!

What no FTP?
If you don’t have any FTP space you can backup across a network/internet connection and setup a PC as an FTP server using the excellent FileZilla.

UPDATE: see comments for some notes from William who suggests some alternative syntax if you have issues with the above and a more logical sequence to protect against things going wrong mid-process.

Unit testing and Test Driven Development (TDD) for Flex and ActionScript 3.0

Wednesday, February 21st, 2007

My good friend and fellow Bristolian Neil Webb has just had an article published on the Adobe Flex Developer Centre. If you’ve heard of unit testing and test driven development and want to know what it’s all about head on over and have a read.

Unit testing and Test Driven Development (TDD) for Flex and ActionScript 3.0

Good stuff Neil!

New Tutorial: Free Flex2 & AS3 with FlashDevelop

Saturday, December 30th, 2006

I have just written up a new tutorial on getting started Flex2/AS3 development with FlashDevelop. The tutorial should take about 30 minutes to complete and should get you up and running ready to get into Flex2 with AS3.

Read the Flex2/AS3 with FlashDevelop tutorial

New Tutorial - Introduction to Flash Remoting with Fluorine

Friday, July 7th, 2006

I’ve just written up my first tutorial on using Fluorine, the open source Flash remoting solution for the .net platform. Have a read and leave any feedback in the comments here.

Introduction to Flash Remoting with Fluorine