Script to backup TM1 data folder to a ZIP file

Product:
Planning Analytics (TM1 10.3 in the cloud)
Windows 2012 server

Problem:
How do you copy my data folder to a zip file for backup during development?
Program is installed to C:
And TM1 instance is installed to S:

Solution:
Drag and drop the 7za.exe file to the desktop in the cloud from your computer when you are in a Remote Desktop Session to the TM1 server.

Place the file in folder S:\prod\tm1\Work\7za920\.

Login in TM1 Architect as ADMIN.

Create a new TI process and enter below in PROLOG tab.

##############START OF CODE##########################

SC_QUOTE_COMMAND = Char(34);
sExec = SC_QUOTE_COMMAND | 'S:\prod\tm1\Work\7za920\7za.exe' | SC_QUOTE_COMMAND;
sBackupDir = SC_QUOTE_COMMAND | 'S:\prod\tm1\1 Backup\';
sDataDir = 'S:\prod\tm1\Data\';

sFileName = 'TM1_backup_' | TIMST(NOW(), '\Y\m\d_\h\i', 1) | '.zip';
sArgs = ' a -tzip ';
sCommand = sExec | sArgs | '   ' | sBackupDir | sFileName | SC_QUOTE_COMMAND | '  ' | sDataDir | '*';

###  Use text output to find the rigth use of " to make the command work
###
### ASCIIOUTPUT  ( 'S:\prod\tm1\Work\test\debuginfo.txt', sCommand );

EXECUTECOMMAND(sCommand,0);
##############END OF CODE##########################

Save above PROLOG as TI process SYS.BACKUP.
If you copy the text from the web to the TM1 architect, you need to replace ´with ‘.
SC_QUOTE_COMMAND need to be put around path strings that contain a space.

Test to run it.

Should give you a file of this format TM1_backup_20160909_0901.zip in folder S:\prod\tm1\1 Backup.
If it works you can create a core in TM1 Architect that first do a SAVEDATAALL and then this backup process from above, set it to run at 2 AM every Sunday.

7za.exe is found from here; http://www.7-zip.org/download.html