Overview
The Backup Case Organizer script creates a copy of the current CaseOrg folder as a method for backing up the Case Organizer and its tabs. The backup is complete copy of the CaseOrg folder, named by the current date and created in \Profiles\AllUsers\CaseOrgBkups.
Description
This script uses the Microsoft Windows FileSystem object (an object-based tool for working with files and folders) extensively. It uses the FileSystem object to check for the presence of an existing CaseOrgBkups folder within the case’s \Profiles\AllUsers directory. It also uses the FileSystem object to create the directory when absent as well as to copy the CaseOrg folder into the CaseOrgBkups folder.
Each backup folder is created by the script using the current date (sans backslashes) as the backup folder’s name. If a folder of the same name already exists the script applies a numeric (incrementing) suffix to the new folder’s name (e.g. if there already is a folder titled 021601 the backup will create one named 021601-1, if that exists then one named 021601-2 will be created, etc).
Collections / Objects / Methods / Properties
Code
sCaseOrgDir = CaseDir() & "profiles\all users\CaseOrg"
sCaseOrgBkupsDir = CaseDir() & "profiles\all users\CaseOrgBkUps"
sDate = Date
'Replaces the slashes in the date so that it
'can be used as a Folder Name
sDate = Replace(sDate, "/", "")
'Creates a new File System Object
Set fso = CreateObject("Scripting.filesystemobject")
FoldName = sDate
'If the CaseOrg folder exists for the case then it checks for the CaseOrgBkups folder
If fso.FolderExists(sCaseOrgDir) Then
'If the CaseOrgBkups exists, then it proceeds with the backing up
If fso.FolderExists(sCaseOrgBkupsDir) Then
Call CheckDup(FoldName)
Call fso.CopyFolder(sCaseOrgDir, sCaseOrgBkupsDir & "\" & NameCh, True)
'Verifies that the backup was created
If fso.FolderExists(sCaseOrgBkupsDir & "\" & NameCh) Then
msg "Case Organizer backed up."
Else
Alert "Case Organizer backup failed"
End If
'If that folder doesn't exist it is created
Else
fso.CreateFolder(sCaseOrgBkupsDir)
Call CheckDup(FoldName)
'Then the backup folder with today's date is copied into it.
Call fso.CopyFolder(sCaseOrgDir, sCaseOrgBkupsDir & "\" & NameCh, True)
'Verifies that the backup was created
If fso.FolderExists(sCaseOrgBkupsDir & "\" & NameCh) Then
msg "Case Organizer backed up."
Else
Alert "Case Organizer backup failed"
End If
End If
End If
'CheckDup is called during the above routine. It checks to see if a folder already exists
'with the backup name. If it does, then it adds a "-n" where n continues to increment
'until there is no longer a duplicate filename
Function CheckDup(FoldName)
i = 1
NameCh = FoldName
Do
DupFile = fso.FolderExists(sCaseOrgBkupsDir & "\" & NameCh)
If DupFile = True Then
i = i+1
NameCh = FoldName & "-" & i
End If
Loop While DupFile = True
End Function
Download File (zipped)
(right click on file and select 'Save Target As...')
NOTICE: This script is provided to you “As is” for use only with a valid CT Summation Enterprise or CT Summation LG family (iBlaze) license, pursuant to the terms of the license. Technical support is not provided for scripts under the CT Summation maintenance agreement or otherwise. The Limitation of Warranties and Liability provisions contained in the license accompanying the CT Summation program with which this script is run shall apply to use of this script with said program.