Backup Drupal with Windows Script

Photo: 
Backup Tapes

If you want to make any changes to your web site, or even just update the modules or software due to new versions coming out, you are always advised to make a backup of your Web site first.

 

You can download the same Windows Batch file that I use which automates the process.

First lets cover what this batch does and does not do.

It does not backup your database. If you have a Drupal site there are various modules you can install, that will backup the Database before runing this script. I'll be writing another post about Database backups in the coming weeks.

This script will copy all files from your web host, to your local PC, and will only work on Windows machines.

This script uses FTP to backup your files.

 

OK, now that's out of the way, I'll assume that your still interested. Lets start making this script work for you

1. Download the Web Site Backup Batch File from the bottom of this post to your Windows machine.

(Right click and "Choose Target as", and then browse to the folder you want to save the file)

2. Rename the downloaded file to be WebSiteBackup-FTP.cmd (remove .txt from the end of the file)

3. Download the free tool - WGET.

As of today you can get the WGET Windows application here, or if that URL changes in the future just search Google

I suggest you make a folder under C:\Program Files called WGET and copy the application there.

4. You need to modify 7 lines in the batch file to make it work with your web host.Opening Notepad in Windows

Open Notepad in Windows.

Start button > Run > Type in notepad > OK

Now open the batch file in Notepad, and we can make a few adjustments.

File > Open > (Change file types = All files) and then browser to WebSiteBackup-FTP.cmd


On line 24 you need to enter a Friendly name of your web site. We make a sub-folder with this name, and put all the files in there, so your web site name would be a good choice here - like SunnyIgloo.com

On line 26, 27 & 28 you need to put in the FTP information. If you don't know this information, it is probably in one of the first emails your web hosting Co sent to you, or you can call their Technical Support staff.


Line 30 is the folder name where we will put the backed up files.

C:\WebSiteBackup\ is the default location. Change this line if you want the files to go to a different drive, or different folder

Remember that we will create another subfolder under this using the Friendly name you set on line 24 - so the full path would become C:\WebSiteBackup\SunnyIgloo.com\


Line 32 tells the script where to find the WGET tool you downloaded earlier.

You will need to put speech marks around the path, and included the application name (wget.exe) at the end of the line 

The line currently is

Set WGETpath="C:\Program Files\WGET\wget.exe"

If you have put the wget application in that folder, then there is no need to change this line.

 

Line 37 has PauseAtEnd=Yes

When first testing you probably want to keep this with PauseAtEnd=Yes. If you schedule the batch file to run automatically then you will want to change this to say PauseAtEnd=No

Now save the batch file.

 

Double Click the batch file, and lets see if it is working.

 

I hope you find this useful

Main blog post image by Vitamindave

Comments

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Mollom CAPTCHA (play audio CAPTCHA)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.