Business Intelligence Blogs

View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.

Simple Versioning And Backups

  • 29 June 2013
  • Author: CraigLove
  • Number of views: 6161
  • 0 Comments

Source control software is a wonderful thing.  There is nothing like the warm fuzzy you get when you know that the last few hours of work will not be lost by a disk failure.  Worse is the feeling in the pit of your stomach when the loss of work is self-inflicted (such as a save of bad over good).   If your organization has the infrastructure in place (and the licensing dollars) Microsoft’s Team Foundation is a great choice.  Another great tool is the Subversion (free) paired with Tortoise (free).  If you would like to integrate your Visual Studio toolset with the subversion, another great product is Visual SVN

Another down and dirty trick I use is to leverage cloud based storage AND a compression tool such as WinZip or WinRAR AND a simple batch file. 

 Here is how it works:

  1. Pick your favorite cloud storage – SkyDrive, DropBox, etc.  Link a local folder to your cloud storage.
  2. Create a batch file that will launch the compression tool.  The trick here is to use the command line switches to select the source files/folders to be archived, compression level, password and the target compressed file name location.   The target folder should be the folder linked to the cloud storage. 

 Once set up, it’s simply a matter of launching the batch file to push a copy of your files to another location.  The script I use appends a date/time stamp to each compression file so that I get a different file each time I use the batch.  I have included a copy of the batch file used in this demo at the end of this post.

 Here is what the process looks like:

 Launch batch file:

Batch File

File is created in the local drive and then synced with Sky Drive.

Sky Drive Syncing

 

File has been synced:

Synced File

 

Another file is created and synced each time you launch the batch file.

2 Synced Files

And here is the batch file I used. 

@echo off
 
cls
 
rem Timestamp Generator
 
rem Parse the date (e.g., Fri 02/08/2008)
 
set cur_yyyy=%date:~10,4%
 
set cur_mm=%date:~4,2%
 
set cur_dd=%date:~7,2%
 
rem Parse the time (e.g., 11:17:13.49)
 
set cur_hh=%time:~0,2%
 
if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
 
set cur_nn=%time:~3,2%
 
set cur_ss=%time:~6,2%
 
set cur_ms=%time:~9,2%
 
rem Set the timestamp format
 
set timestamp=%cur_yyyy%%cur_mm%%cur_dd%-%cur_hh%%cur_nn%%
 
rem Do something with it
 
rem echo Timestamp: %timestamp%
 
WinRAR.exe a -s -r -m5 "C:\Users\clove\SkyDrive\Professional\Version 1.1 ETL Documentation_"%cur_yyyy%%cur_mm%%cur_dd%-%cur_hh%%cur_nn%%".rar" "Version 1.1\Documentation\ETL\*.*"

rem pause


I have used this in many cases and still get the warm fuzzy of knowing I have yet another safety net!

 

Happy coding!

Print
Categories: Analysis Services
Tags:
Rate this article:
No rating

CraigLoveCraigLove

Other posts by CraigLove

Please login or register to post comments.