Backup TI source files

Example files with this article:
  • Backup TI source files
  • Introduction

    Continuing with the previous article on how to list all TI processes of a given TM1 model, we now present a way to easily backup source files of TI processes. We will go by each TI process of the TM1 server, derive the source file if there is one, and copy that file in a central folder.

    VBA code

    The code is worth investigating but no rocket science VBA code. So I bet you will understand it without much help from my part.

    Sub Backup_TI_Source_Files()
    ' Wim Gielis ' https://www.wimgielis.com
    ''''' ' VBA-code to backup or copy TI process source files ' 08/10/11 '''''
    Const sTargetPath = "D:\Backup files\" 'CHANGE TO SUIT On Error Resume Next For Each sFile In ActiveSheet.UsedRange.Columns(1).Cells If UCase(sFile.Offset(, 1)) = "CHARACTERDELIMITED" Then sSourceFile = sFile.Offset(, 2) sTargetFile = sTargetPath & Right(sSourceFile, Len(sSourceFile) - InStrRev(sSourceFile, "\")) If sSourceFile <> sTargetFile Then FileCopy sSourceFile, sTargetPath & Right(sSourceFile, Len(sSourceFile) - InStrRev(sSourceFile, "\") + 1) End If End If Next On Error GoTo 0
    End Sub

    Minimize errors

    We need to catch possible errors using On Error Resume Next. For instance, the user executing the procedure is not allowed to copy a file, a file cannot be found, a typo in the target path, and so on.

    Download

    You could include a check on the file size when you copy a file: files that are way too big could be excluded for instance. On top of the page you can download an Excel file with my code.




    Homepage

    Section contents

    About Wim

    Wim Gielis is a Business Intelligence consultant and Excel expert

    Other links