Automate the backup of project files on a local hard drive.

Jimbo's picture

Snapshots of the data stored in a central location for a project have proven invaluable in too many situations to count. It is an important part of a Data Conversion Team Lead's best practices and should be performed early each day when network traffic is low.

A catastrophic hardware failure or accident can set a project back months if due care is not taken. Even when the internal IT department is performing backups it may be difficult to reach them and have a single file or folder restored. A lost or corrupted file can disrupt a project while the IT professional finds the right tape, finds the right file on the tape and then restores it to the project folder. In some larger organizations the IT department may be inaccessible behind tiers of apathetic helpdesk employees or online forms that go unseen for days.

A simple batch file linked to from the Startup folder on a workstation is more than enough to ensure the constant availability of data vital to an SAP implementation. The batch file can create multiple snapshots of the data going back for a predetermined number of weeks or months and the Startup link causes the batch to be run each day when logging into the workstation.

This batch file is completely self-contained and requires no additional software. Two weeks of daily backups can mean the difference between a successful SAP implementation and delayed go-live or even project failure.

A simple batch to keep backups for 10 business days.

@Echo off
REM *   This is a very simple backup software used to take a snapshot 
REM *   of a single folder on the network.
  
REM *   Replace YOUR_FOLDER_LOCATION with the location of your data. 
REM *   For example: \\server\share\data_folder or z:\data_folder

set DataSource=YOUR_FOLDER_LOCATION
echo %DataSource%

md c:\backups

erase c:\backups\backup.010 /f /s /q
rmdir c:\backups\backup.010 /s /q

set DayBefore=010

for %%A in (009 008 007 006 005 004 003 002 001) do (
  rename c:\backups\backup.%%A backup.%DayBefore%
  set DayBefore=%%A
)

md c:\backups\backup.001
xcopy %DataSource% c:\backups\backup.001 /s/e/c/d/h/i/y > c:\backups\backup.001\backup.log

REM *   Optional: Save some space by compressing the files. 
REM *   Text files compress very well.
compact /c /s /i c:\backups\*.*

Make a c:\backups folder and then save the above text into c:\backups\backup.bat. Be careful not to save the file with a ".txt" extention; Notepad defaults to .txt during the save process unless the file type is set to "All Files". Create a shortcut in the Startup folder by right-clicking on Startup and choosing Explore. Right-click in the folder and choose NewShortcut. Type c:\backups\backup.bat as the location of the item.