Backup DacEasy data automatically for multiple companies 3


You might want to read the previous articles before proceeding:
Part 1Need a Quicker way to backup DacEasy Data?
Part 2Choosing what DacEasy files to backup

are not familiar with running batch files in windows, please consider an alternative.

Create a new folder on your C:\ drive called dacBackup

Copy the following code into a new file called “dacBackup.cmd” and save it in the same folder:

:: First, I create a temporary directory to copy the data to.
md c:\dacBackup\DacEasy
:: Copy each of the individual modules from
:: their working directories to the temporary directory.
(xcopy C:\DacEasy\bc\profiles\DacEasyCompany1 C:\dacBackup\DacEasy\bc\profiles\DacEasyCompany1 /I /E /V /Y
xcopy C:\DacEasy\ac\DacEasyCompany1 C:\dacBackup\DacEasy\ac\DacEasyCompany1 /I /E /V /Y
xcopy C:\DacEasy\py\DacEasyCompany1 C:\dacBackup\DacEasy\py\DacEasyCompany1 /I /E /V /Y
xcopy C:\DacEasy\bc\profiles\DacEasyCompany2 C:\dacBackup\DacEasy\bc\profiles\DacEasyCompany2 /I /E /V /Y
xcopy C:\DacEasy\ac\DacEasyCompany2 C:\dacBackup\DacEasy\ac\DacEasyCompany2 /I /E /V /Y
xcopy C:\DacEasy\py\DacEasyCompany2 C:\dacBackup\DacEasy\py\DacEasyCompany2 /I /E /V /Y
) > C:\dacBackup\dacCopy.log
:: By enclosing the XCOPY commands in parenthesis, I
:: can create a single log file of every command within
:: the group. This logfile is created and saved as
:: “C:\dacBackup\dacCopy.log”
@echo off
:: Set Variables
set Today=%Date:~4,2%-%Date:~7,2%-%Date:~10,4%
set fileName=DacBackup
set dDay=%Date:~0,3%
set BackupFolder=C:\dacBackup
set BackupFile=%BackupFolder%\%fileName%(%dDay%)Full.bkf
set JobName=%Today% DacEasy Backup
set Description=DacEasy Backup %Today%
:: Back up Files and Shares
C:\windows\system32\ntbackup.exe backup “C:\dacBackup\DacEasy” /n “DacEasy Backup %Today%” /d “%Description%” /v:yes /r:no /rs:no /hc:off /m normal /j “%JobName%” /f “%BackupFile%”
:: Removes temporary directory
rd /S /Q c:\dacBackup\DacEasy

If you have trouble trying to copy and paste the code above, I have also provided the script for download in 2 different compressed file formats (ZIP and RAR):

Download

Download

If you choose to download one of the compressed files, you will have to extract and decompress the file. Windows XP should be able to open ZIP files natively. If you still have trouble extracting the file, you can get a free evaluation of Winzip from their website

Don’t forget to modify the XCOPY commands to point to your actual DacEasy directories.

Once you have finished modifying the “dacBackup.cmd” file, you can try it out by double-clicking on it.

If it worked, you will notice a new file inside the dacBackup folder which contains a backup of your DacEasy data folders.

« Part 2Choosing what DacEasy files to backup

Part 4Automating your backup script »


Leave a Reply