Guide - Automated Backup


Recommended Posts

Simple little backup script which will backup some files using winrar and upload them to a ftp server automatically.

Some requirements

1.Install WinRAR (www.winrar.com)

2.Remote FTP Server

?

Load up notepad and type the following:

@ECHO OFF
?
echo Please Wait...Backup in progress.
?
>backup_list.script ECHO D:\
>>backup_list.script ECHO E:\Important

?

?

The important parts are >backup_list.script ECHO D:\ and the line below. These lines will tell winrar which files to backup.

?

>backup_list.script ECHO D:\ - Anything after the ECHO is printed to a file called ‘backup_list.script’. In this case D:\ (where my documents are). It is important for the first line to have a single ‘>’. This creates a new file. Add as many ‘>>’ lines as you want with all the paths you wish to backup.

?

Next the exclusion lists. Winrar will backup ALL files with in the directories listed above, this is not always practical. Add any exclusions using the following commands:

?

>backup_x_list.script ECHO D:\Do Not Backup Folder
>>backup_x_list.script ECHO D:\Borland Studio Projects
>>backup_x_list.script ECHO D:\System Volume Information
>>backup_x_list.script ECHO D:\My PSP Files
?
>>backup_x_list.script ECHO D:\desktop.ini
>>backup_x_list.script ECHO D:\Default.rdp

?

Remember the first line must have a single ‘>’. If adding a directory do not include a final slash. For files include the full path.

?

Next the important part:

?
"C:\Program Files\WinRAR\RAR.exe" a -hppassword -m5 -r E:\ \backup.rar @backup_list.script -t -x@backup_x_list.script
?

This tells winrar to execute and create a new archive including and excluding the files listed above. The archived will be called ‘backup.rar’. The command ‘-hppassword’ adds a password to the archive for security, change password to something else eg. ‘-hpnewpassword’.

?

Now upload the files to the web.

?

echo Please Wait...Uploading Files.
>script.ftp ECHO username
>>script.ftp ECHO password
>>script.ftp ECHO cd backup_folder/
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put backup.rar
>>script.ftp ECHO quit

?

Change username and password to the correct values. Change ‘CD backup_folder/’ to where ever you wish the file to be saved remotely. Remember to include the final slash.

?

?

Next to connect the ftp site and run the script:

?
FTP -v -s:script.ftp ftp.ftpsite.net
?

Change ftp.ftpsite.net to your site.

?

Delete the scripts:

?

DEL script.ftp
DEL backup_x_list.script
DEL backup_list.script
?

?All done.

Set up Scheduling using the built in Windows Scheduled Tasks application.

Start->Settings->Control Panel->Scheduled Tasks->Add Scheduled Task

and follow the wizard. I have mine to run every sunday night.

My complete script:

@ECHO OFF


echo Please Wait...Backing Up Files.
>backup_list.script ECHO D:\

>backup_x_list.script ECHO D:\Borland Studio Projects
>>backup_x_list.script ECHO D:\Installed
>>backup_x_list.script ECHO D:\Documents
>>backup_x_list.script ECHO D:\System Volume Information
>>backup_x_list.script ECHO D:\My PSP Files
>>backup_x_list.script ECHO D:\desktop.ini
>>backup_x_list.script ECHO D:\Default.rdp

"C:\Program Files\WinRAR\RAR.exe" a -hpMYPASSWORD -m5 -r backup.rar @backup_list.script -t -x@backup_x_list.script

echo Please Wait...Uploading Files.
>script.ftp ECHO USERNAME
>>script.ftp ECHO PASSWORD
>>script.ftp ECHO cd backup/
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put backup.rar
>>script.ftp ECHO quit


FTP -v -s:script.ftp ftp.MYFTPSITE.net

DEL script.ftp
DEL backup_x_list.script
DEL backup_list.script


Echo Done.....

I hope some people find this useful.

Edited by B3AN
Link to comment
Share on other sites

Some files you may wish to backup.

Opera

Take a look at : Site

Firefox

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\bookmarks.html

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cert8.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cookies.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\prefs.js

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\signons.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\key3.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\extensions\

Link to comment
Share on other sites

Yeah that is a problem for a large backup you do need alot of space. Before I got alot of ftp space I only used to backup important settings and files.

Link to comment
Share on other sites

Some files you may wish to backup.

Opera

Take a look at : Site

Firefox

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\bookmarks.html

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cert8.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cookies.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\prefs.js

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\signons.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\key3.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\extensions\

585984940[/snapback]

cheers for that too. almost forgot my bookmarks!

Link to comment
Share on other sites

(i know this is triple post, sorry).

I need some help.

This is what i have:

@ECHO OFF

echo Please Wait...Backup in progress.

>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\bookmarks.html
>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\signons.txt
>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\prefs.js
>>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\cookies.txt

"D:\Program Files\WinRAR\RAR.exe" a -hpeggs -m5 -r backup.rar @backup_list.script -t -x@backup_x_list.script

echo Please Wait...Uploading Files.
>script.ftp ECHO bhav
>>script.ftp ECHO ******
>>script.ftp ECHO backup/
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put backup.rar
>>script.ftp ECHO quit

FTP -v -s:script.ftp ftp.******.com

DEL script.ftp
DEL backup_x_list.script
DEL backup_list.script

Echo Done.....

but when i run the .bat, the command prompt window flashes (disappears very quickly), and i just get a file created in the same directory as the .bat called backup_list.script, which only says the following:

C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\bookmarks.html
C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\signons.txt

Any idea what's wrong?

(NB: winrar is installed on the D drive on my pc)

Link to comment
Share on other sites

>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\prefs.js

>>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\cookies.txt

...

Any idea what's wrong?

586004857[/snapback]

Only use >> for those lines, not >>> or >>>>.

Link to comment
Share on other sites

Only use >> for those lines, not >>> or >>>>.

586004995[/snapback]

oh right i see.

ok so the script has got a bit further this time.

but now there's an error in command prompt.

it says:

Cannot open backup_x_list.script

The system cannot find the file specified

then it tries to upload, but there's nothing to upload.

edit: nevermind all sorted, just removed the bit about backup_x_list.script in the script.

thanks for this script, and cheers for the help hurting101.

Edited by Bhav
Link to comment
Share on other sites

Your script so usefull !

But i can't connect to FTP server automatically

I tried many times but it's always not success

Please tell me Why ? and how can i do ?

Link to comment
Share on other sites

Your script so usefull !

But i can't connect to FTP server automatically

I tried many times but it's always not success

Please tell me Why ? and how can i do ?

586038531[/snapback]

What sort of errors are popping up? if any.

Link to comment
Share on other sites

Nice, but I have 56k and make CD backups with an external USB CD-RW drive.

Any way of adapting the sc

586065267[/snapback]

I agree, is it possible for you to show us how to modify the script to back up to a another disk/partition/machine on the local network?

Link to comment
Share on other sites

I agree, is it possible for you to show us how to modify the script to back up to a another disk/partition/machine on the local network?

586069186[/snapback]

Well instead of the ftp section you could use the copy command for example:

Network Drive:

copy backupfile.rar \\network\share\backupfile.rar

Normal Folder:

copy backupfile.rar e:\Backups\backupfile.rar

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.