Welcome to the Small Business Ideas Forum! We are a community of over 100,000 small business folks with over 163,000 posts for you to browse. We pride ourselves on being the friendliest forum you will find and we'd love to have you as a member of our community. Please take a moment and register for a free account. If you need any help, please contact Chris Logan.

Small Business Ideas Forum

Small Business Ideas Forum

A friendly place to share small business ideas and knowledge, ask questions, find help and encourage others that are involved in the small business industry. Topics include small business marketing, generating revenue and small business computing.

Go Back   Small Business Ideas Forum > Small Business Computing > Computer Security
Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
Old 9th December 2005, 06:51 PM   #1
StupidScript
Administrator
 
StupidScript's Avatar
 

Join Date: Jul 2004
Location: Los Angeles
Posts: 604
Default Easy Backups with WinZip

In addition to the various tools that keep intruders out, your security protocol must include a robust backup procedure (or two). When your primary accounting system goes down and takes its data with it, you'll want a recent backup. Really.

I use a combination of "Command Line WinZIP" (downloadable) and DOS batch files to accomplish daily backups of all of my company's important files.

Here's how I do it:

## Overview ##

Databases must be copied to a temporary directory before archiving so you don't encounter problems when the file is still open by another user. You will end up with one dated archive for all databases, using my method below.

Documents should be incrementally backed up so any changes made are preserved. Most documents don't change that much, so this keeps your backups down to a reasonable size, and you can use a single archive per employee for the backup.

The following represents several files, divided by my notes. Copy and paste and modify each bit between the equals-signed lines as a separate file. Some monitors (800x600) will break the lines incorrectly. If you copy and paste from this forum, the lines will break properly. There's probably not enough detail here for a complete newbie to run with it, but hopefully it's linear enough to get a handle on the technique.

## Backing up Databases ##

Once these files have been created and modified to fit your situation, you will simply run "dbBack.bat" once per day (I use WinCron for that), and your databases will be backed up in dated archives. I will typically delete any archive more than 3 days old, just in case I need to roll back the databases for some user-related reason (malicious behavior over the past couple of days, etc.).

=== dbBack.bat =====
rem COPIES VENDOR_DB TO TEMP DIR
rem NO NEED TO SEE THE OUTPUT, SO TURN OFF ECHOING
@echo off
rem SWITCH TO THE MAPPED NETWORK DATABASE DRIVE
f:
rem COPY ONE DB AT A TIME TO THE TEMP DIRECTORY
copy Databases\Vendor_Database.mdb D:\AutoBack\dbs\Vendor_Database.mdb
rem SWITCH BACK TO THE BACKUP DRIVE
d:
rem JUMP INTO THE DIRECTORY WITH ALL OF THE BATCH FILES
cd AutoBack
rem START THE NEXT BATCH FILE
rem IN THIS CASE, THE NEXT DB BATCH FILE TO ADD TO ZIP
start dbBack2.bat
rem CLEAR THE SCREEN (IN CASE OF INCIDENTAL OUTPUT)
cls
rem KILL THIS BATCH FILE PROCESS
exit
==== end dbBack ====

Add another database to the backup .ZIP file

=== dbBack2.bat =====
rem COPIES SALES_DB TO TEMP DIR
rem NO NEED TO SEE THE OUTPUT, SO TURN OFF ECHOING
@echo off
rem SWITCH TO THE MAPPED NETWORK DATABASE DRIVE
f:
rem COPY ONE DB AT A TIME TO THE TEMP DIRECTORY
copy Databases\Sales_Database.mdb D:\AutoBack\dbs\Sales_Database.mdb
rem SWITCH BACK TO THE BACKUP DRIVE
d:
rem JUMP INTO THE DIRECTORY WITH ALL OF THE BATCH FILES
cd AutoBack
rem START THE NEXT BATCH FILE
rem IN THIS CASE, THE ACTUAL BACKUP SEQUENCE STARTS
start getdate.bat
rem CLEAR THE SCREEN (IN CASE OF INCIDENTAL OUTPUT)
cls
rem KILL THIS BATCH FILE PROCESS
exit
==== end dbBack2 ====

To add additional databases to the archive, simply make more batch files as above, and start the next database batch file instead of "getdate.bat". In your final database batch file, start "getdate.bat" as above to do the backup. I find it useful to name the database batch files incrementally (i.e. dbBack, dbBack2, dbBack3, etc.) because when I want to add a new one, I can easily either jump into the middle of the batch sequences or add the new db to the end of the sequence.

==== getdate.bat ====
rem GETS CURRENT TIMESTAMP FOR ZIP NAME
@echo off
rem DUMP (>) THE OUTPUT FROM DATE PROCEDURE INTO VARIABLE
echo.|date|find "current" >tmpdat
rem DO MAGIC TO CONVERT CURRENT DATE FROM VARIABLE TO ENTITIES
FOR /f "tokens=6-8 delims=/ " %%a in (tmpdat) do SET
rem SET NEW DATE VARIABLE USING ENTITY REFERENCES
zipdate=%%c%%a%%b
rem CLEAR TEMP VARIABLE
del tmpdat
rem DOS HOLDS THE NEW VARIABLE (zipdate) IN MEMORY,
rem SO THE NEXT BATCH FILE CAN USE IT. LET'S MAKE THE ZIP ...
start makezip.bat
rem CLEAR SCREEN
cls
rem KILL PROCESS
exit
==== end getdate ====

Here's the meat ... we've copied the databases to the temp directory, and hooked up a distinct variable (the date) for the archive file name. Let's start WinZip on the command line and make an archive out of the files in the temp directory. I'm not going to comment on the common stuff, anymore.

==== makezip.bat ====
rem ZIPS DBs
@echo off
rem LAUNCH CLI WINZIP WITH A SWITCH THAT SAYS
rem 'MAKE AN ARCHIVE USING MAXIMUM COMPRESSION'.
rem USE THE DATE VARIABLE STILL IN MEMORY FOR THE NAME,
rem AND GET THE FILE LIST TO INCLUDE FROM THE (@) FILE
wzzip -ex %zipdate%.zip @dblist.txt
start cleardbs.bat
cls
exit
==== end makezip ====

If you have made more batch files for more databases, be sure they are all included in "dblist.txt". This is the file WinZip looks to for which databases to include in the archive. One complete path per line. MUST END with a carriage return!

==== dblist.txt ====
d:\AutoBack\dbs\Vendor_Database.mdb
d:\AutoBack\dbs\Sales_Database.mdb
==== end dblist ====

Likewise, include additional databasees in "cleardbs.txt" to assure their removal once the archiving is complete. Remember that these are only copies, so you're just doing a little housekeeping, here.

==== cleardbs.bat ====
rem DELETES DBs FROM TEMP DIR
@echo off
del d:\AutoBack\dbs\Vendor_Database.mdb
del d:\AutoBack\dbs\Sales_Database.mdb
cls
exit
==== end cleardbs ====

That's it. If you use the same paths as I have, you'll end up with a dated .ZIP archive in d:\AutoBack. I burn the latest .ZIP file onto a CD and take it home with me each weekend ... just in case the office explodes ...

## Incrementally Backing up Employee Documents ##

Similarly, once these files have been modified to suit you, simply run "zip_employeeA.bat" once per day to perform the incremental backup.

==== zip_employeeA.bat ====
rem ZIPS DOCs\EMPLOYEEA
@echo off
rem RUN CLI WINZIP WITH SWITCHES THAT SAY
rem 'ONLY MAKE COPIES OF FILES THAT HAVE CHANGED, AND
rem OVERWRITE ANY OLD ONES IN THE .ZIP ARCHIVE.' ALSO,
rem DON'T INCLUDE ANY FILE TYPES LISTED IN exclude.txt
rem DO INCLUDE FILES LISTED IN employeea.txt
rem OVERWRITE THE OLD EMPLOYEE ARCHIVE .ZIP
wzzip.exe -ex -u -r -P -ybc [email protected] d:\AutoBack\docs\EmployeeA.zip @employeea.txt
rem DO THE NEXT EMPLOYEE'S BATCH FILE
rem IF THERE IS ONE, UN-COMMENT THE NEXT LINE (REMOVE rem )
rem start zip_employeeB.bat
rem OTHERWISE ... CLEAR SCREEN AND KILL PROCESS
cls
exit
==== end zip_employeeA ====

Files types and files NOT to back up are listed in exclude.txt. I don't back up programs or other large files, because they are usually recoverable from another source and are too large to be convenient for burning to CD.

==== exclude.txt ====
*.pdf
*.tif
*.exe
*.zip
my_todo_list.xls
==== end exclude ====

Directories where to find the documents to back up for each employee. Note that each employee would have their own batch file and their own .TXT file.

==== employeea.txt ====
f:\DOCUMENTS\EmployeeA\*.*
==== end employeea ====

All batch files were created with Notepad and simply saved with the proper file extension into a common directory (D:\AutoBack). The .BAT file extension makes that little old text file "executable" (like many worms and viruses, BTW.)

The WinZip command line program must be in the same directory as the batch files.

(Did you notice that my second database batch file example used "wzzip.exe" instead of "wzzip", as the first example did? I was illustrating that when you use the command line to execute a program in Windows/DOS, you don't need to add the file extension unless you have another similar file in the same directory, like "wzzip.txt".)

This ends my presentation. I will now open the floor to questions ...

If you like, please sticky me with a request and I'll send you a .ZIP file with each of these examples as separate files. I'm offline for this weekend, but I'll get to you next week. Make sure to include your email address ...

__________________
James Butler - "Do no weevils"
JamesButler.net
MusicForHumans.com

Last edited by StupidScript; 9th December 2005 at 10:02 PM. Reason: Additions and Comments
StupidScript is offline   Reply With Quote
Register or log in to remove this ad.
Reply   

Bookmarks




Thread Tools

Get Updates
RSS Feeds:
RSS Feed for Computer Security RSS for this Category Only: Computer Security

RSS Feed for Small Business Ideas Forum RSS for Entire Forum
Forum Rules


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Small Business Ideas Forum


 
At Your Business - Small Business Directory
Free Business Forms - Prewritten Documents
 
Search Engine Guide
Small business guide to search marketing

 
Small Business Brief
Fetching the Best Small Business Info


Used Values - Free Links
Blue Book





All times are GMT -5. The time now is 02:43 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004 - 2018 - Privacy