<< Click to Display Table of Contents >> Navigation: Using SyncBackPro > Technical Reference > Scripting > SBRunning |
These are functions that can be accessed from scripts via the SBRunning object. For example:
SBLocation.Warning('Filename', 'Warning message');
The SBRunning object is only accessible from Runtime scripts.
All the example code below is written in using the Pascal scripting language.
function FolderHasFiles(Name);
Name: The name of the folder (not including the base folder)
Return value: Always returns FALSE
This function is no longer used and will always return FALSE.
function GetCurrentFileVer(Filename, Left);
Filename: The filename (not including the base folder)
Left: Pass True to get the details of the left/source file
Return value: The current file version, or -2 if it isn't set to use a different version
This function returns the version of the file that is going to be restored, or -2 if it isn't set to use restore a version.
See the function GetFileVerCount to get the number of versions a file has.
Note that the filenames do not include the base folder.
function GetFileAction(Filename);
Name: The name of the file (not including the base folder)
Return value: The action to be performed
This function returns the action that will be performed for a particular file. Note that the filename should not include the base folder. If the file does not exist then 0 (CACTION_ERROR) is returned.
For folders see GetFolderAction
function GetFileAttrs(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the attributes of the left/source file
Return value: The files attributes
This function returns a files filesystem attributes. Note that the filename should not include the base folder. If the file does not exist then -2 is returned. If the file has no file attributes, then -1 is returned.
To set a files attributes use SetFileAttrs
See also GetFileDetailsEx
function GetFileCreateDateTime(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the create date & time of the left/source file
Return value: The files creation date & time
This function returns the creation date & time of a file (in the local timezone). Note that the filename should not include the base folder. If the file does not exist then 0.9 is returned. If the file has no date & time then 1.0 is returned.
To set a files createion date and time use SetFileCreateDateTime
See also GetFileDetailsEx
function GetFileDateTime(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the date & time of the left/source file
Return value: The files last modification date & time
This function returns the last modification date & time of a file (in the local timezone). Note that the filename should not include the base folder. If the file does not exist then 0.9 is returned. If the file has no date & time then 1.0 is returned.
To set a files modification date and time use SetFileDateTime
See also GetFileDetailsEx
function GetFileDetails(Filename, Left; var StoredName; var Size; var Attrs; var Hash; var ModDateTime; var Exists);
Filename: The filename (not including the base folder)
Left: Pass True to get the details of the left/source file
StoredName: Deprecated, will always return an empty string
Size: The size of the file in bytes (note this is a string if using VBScript)
Attr: The filesystem attributes of the file
Hash: The CRC32 hash value of the file (as a string)
ModDateTime: The last modification date & time of the file (local timezone)
Exists: Returned as True if the file exists on either the left/source or right/destination
Return value: False if the file does not exist on either the left/source or right/destination
This function returns all the details of a file in a single call. It is more efficient to use this function if more than a single piece of information on a file is required. Note that the filename should not include the base folder.
It is recommended that you use the newer GetFileDetailsEx function instead of this function.
If the file does not exist at all on either the left/source or right/destination then False is returned and Exists is set to False. However, if you request the details of the file on the left/source and the file only exists on the right/destination, for example, then False is returned but Exists is set to True. If Exists is True then the file does exist on the left/source or right/destination (or both).
For example:
DoesNotExist:=SBRunning.GetFileDetails(Filename, TRUE, StoredName, Size, Attrs, Hash, ModDateTime, Exists);
function GetFileDetailsEx(Filename, Left; var StoredName; var Size; var Attrs; var Hash; var ModDateTime; var CreateDateTime; var NTFSSec,; var Exists);
Filename: The filename (not including the base folder)
Left: Pass True to get the details of the left/source file
StoredName: Deprecated, will always return an empty string
Size: The size of the file in bytes (note this is a string if using VBScript)
Attr: The filesystem attributes of the file
Hash: The CRC32 hash value of the file (as a string)
ModDateTime: The last modification date & time of the file (local timezone)
CreateDateTime: The creation date & time of the file (local timezone)
NTFSSec: The NTFS security of the file (string format)
Exists: Returned as True if the file exists on either the left/source or right/destination
Return value: False if the file does not exist on either the left/source or right/destination
This function returns all the details of a file in a single call. It is more efficient to use this function if more than a single piece of information on a file is required. Note that the filename should not include the base folder.
If the file does not exist at all on either the left/source or right/destination then False is returned and Exists is set to False. However, if you request the details of the file on the left/source and the file only exists on the right/destination, for example, then False is returned but Exists is set to True. If Exists is True then the file does exist on the left/source or right/destination (or both).
For example:
DoesNotExist:=SBRunning.GetFileDetailsEx(Filename, True, StoredName, Size, Attrs, Hash, ModDateTime, CreateDateTime, NTFSSec, Exists);
function GetFileDiff(Filename);
Filename: The filename (not including the base folder)
Return value: The difference between the files
This function returns the differences between a file in the left/source and/or right/destination. Note that the filename should not include the base folder. If the file does not exist then 0 (CDIFF_IDENTICAL) is returned.
For folders see GetFolderDiff
function GetFileHash(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the hash value of the left/source file
Return value: The files CRC32 hash value (as a string)
This function returns the calculated CRC32 hash value (in string format) of a file. This function does not calculate the hash value, it merely returns the hash value that has already been calculated. Note that the filename should not include the base folder. If the file does not exist, or has no CRC32 hash value, then an empty string is returned.
To set a files hash value use SetFileHash
See also GetFileDetailsEx, MD5, and CRC32
Row: The row number of the file to retrieve
Return value: The filename or an empty string on failure
This function returns the name of a file based on its row number. Row numbers start at zero and end at FileCount - 1 (as it is zero based).
The filename can be used with functions such as GetFileDetailsEx.
function GetFileNTFSSecurity(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the NTFS security of the left/source file
Return value: The files NTFS security (as a string)
This function returns the NTFS security (in string format) of a file. Note that the filename should not include the base folder. If the file does not exist, or has no NTFS security, then an empty string is returned.
To set a files NTFS security use SetFileNTFSSecurity
See also GetFileDetailsEx
function GetFileSize(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the size of the left/source file
Return value: The files size in bytes
This function returns the size of a file (in bytes). Note that the filename should not include the base folder. If the file does not exist then -2 is returned. If the file size is unknown then -1 is returned. In VBScript this function returns a string to avoid the 32-bit integer limit in VBScript.
To set a files size use SetFileSize
See also GetFileDetailsEx
function GetFileVerCount(Filename, Left);
Filename: The filename (not including the base folder)
Left: Pass True to get the details of the left/source file
Return value: The number of versions a file has, or zero if it has no versions
This function returns the number of versions a file has, or zero if it has no versions. Note that the result includes delta hash files, which aren't technically versions.
See the function GetCurrentFileVer to get the version number which will be restored.
Note that the filenames do not include the base folder.
function GetFolderAction(Name);
Name: The name of the folder (not including the base folder)
Return value: The action to be performed
This function returns the action that will be performed for a particular folder. Note that the folder name should not include the base folder. If the folder does not exist then 0 (CACTION_ERROR) is returned.
For files see GetFileAction
function GetFolderAttrs(Filename, Left);
Name: The folder (not including the base folder)
Left: If True then return the attributes of the left/source folder
Return value: The folders attributes
This function returns a folders filesystem attributes. Note that the path should not include the base folder. If the folder does not exist then -2 is returned. If the folder has no attributes, then -1 is returned.
To set a files attributes use SetFolderAttrs
See also GetFolderDetailsEx
function GetFolderCreateDateTime(Name, Left);
Name: The folder (not including the base folder)
Left: If True then return the create date & time of the left/source folder
Return value: The folders creation date & time
This function returns the creation date & time of a folder (in the local timezone). Note that the path should not include the base folder. If the folder does not exist then 0.9 is returned. If the folder has no date & time then 1.0 is returned.
To set a folders createion date and time use SetFolderCreateDateTime
See also GetFolderDetailsEx
function GetFolderDateTime(Name, Left);
Name: The folder (not including the base folder)
Left: If True then return the date & time of the left/source folder
Return value: The folders last modification date & time
This function returns the last modification date & time of a folder (in the local timezone). Note that the path should not include the base folder. If the folder does not exist then 0.9 is returned. If the folder has no date & time then 1.0 is returned.
To set a folders modification date and time use SetFolderDateTime
See also GetFolderDetailsEx
function GetFolderDetails(Foldername, Left; var StoredName; var Exists);
Foldername: The folder name (not including the base folder)
Left: Pass True to get the details of the left/source folder
StoredName: Deprecated, will always return an empty string
Exists: Returned as True if the folder exists on either the left/source or right/destination
Return value: False if the folder does not exist on either the left/source or right/destination
This function returns all the details of a folder in a single call. It is more efficient to use this function if more than a single piece of information on a folder is required. Note that the folder name should not include the base folder.
It is recommended that you use the newer GetFolderDetailsEx function instead of this function.
If the folder does not exist at all on either the left/source or right/destination then False is returned and Exists is set to False. However, if you request the details of the folder on the left/source and the folder only exists on the right/destination, for example, then False is returned but Exists is set to True. If Exists is True then the folder does exist on the left/source or right/destination (or both).
For example:
DoesNotExist:=SBRunning.GetFolderDetails(Foldername, True, StoredName, Exists);
function GetFolderDetailsEx(Foldername, Left; var StoredName; var Exists);
Foldername: The folder name (not including the base folder)
Left: Pass True to get the details of the left/source folder
StoredName: Deprecated, will always return an empty string
Attr: The filesystem attributes of the folder
ModDateTime: The last modification date & time of the folder (local timezone)
CreateDateTime: The creation date & time of the folder (local timezone)
NTFSSec: The NTFS security of the folder (string format)
Exists: Returned as True if the folder exists on either the left/source or right/destination
Return value: False if the folder does not exist on either the left/source or right/destination
This function returns all the details of a folder in a single call. It is more efficient to use this function if more than a single piece of information on a folder is required. Note that the folder name should not include the base folder.
If the folder does not exist at all on either the left/source or right/destination then False is returned and Exists is set to False. However, if you request the details of the folder on the left/source and the folder only exists on the right/destination, for example, then False is returned but Exists is set to True. If Exists is True then the folder does exist on the left/source or right/destination (or both).
For example:
DoesNotExist:=SBRunning.GetFolderDetailsEx(Foldername, True, StoredName, Attr, ModDateTime, CreateDateTime, NTFSSec, Exists);
Name: The name of the folder (not including the base folder)
Return value: The difference between the folders
This function returns the differences between a folder in the left/source and/or right/destination. Note that the folder name should not include the base folder. If the folder does not exist then 0 (CDIFF_IDENTICAL) is returned.
For files see GetFileDiff
Row: The row number of the folder to retrieve
Return value: The name or an empty string on failure
This function returns the name of a folder based on its row number. Row numbers start at zero and end at FolderCount - 1 (as it is zero based).
The filename can be used with functions such as GetFolderDetails.
function GetFolderNTFSSecurity(Filename, Left);
Filename: The folder path (not including the base folder)
Left: If True then return the NTFS security of the left/source folder
Return value: The folders NTFS security (as a string)
This function returns the NTFS security (in string format) of a folder. Note that the path should not include the base folder. If the folder does not exist, or has no NTFS security, then an empty string is returned.
To set a folders NTFS security use SetFolderNTFSSecurity
See also GetFolderDetailsEx
function GetMovedName(Filename);
Filename: The filename (not including the base folder)
Return value: The file it has been moved from or to
This function returns the name a file has been moved from or to. For example, if SyncBack detects that file \folder\file.txt has been moved to \somewhere\else.txt then calling GetMovedName('\folder\file.txt') will return '\somewhere\else.txt' and calling GetMovedName('\somewhere\else.txt') will return '\folder\file.txt'
Note that the filenames do not include the base folder.
If the file has not been moved, or does not exist, then an empty string is returned.
function GetRuntimeValue(ValueToGet);
ValueToGet: The runtime value to returm
Return value: The value as a signed 32-bit integer
Returns a runtime value for the current profile. For more details see the description of the GetRuntimeValueStr function.
Note that this function returns 32-bit values, so if the value is 64-bit you should instead use the GetRuntimeValueStr function to return it as a string.
function GetRuntimeValueStr(ValueToGet);
ValueToGet: The runtime value to returm
Return value: The value as a string
Returns a runtime value for the current profile. This is useful to retrieve constantly updating information about the current profile, e.g. how many bytes it has copied so far. Sometimes this information is also available using variables, but often the variables aren't updated until certain stages have completed.
In VBScript, the value is returned as a string to get around 64-bit limitations in VBScript. Some of the values are 32-bit integers so they can safely be retrieved using the GetRuntimeValue function instead.
ValueToGet can be one of the following:
The following counters are updated during the scanning stage. A file or folder with the same name on both the source/left and destination/right is counted as one file or folder and not two. These are signed 32-bit integers.
0: The number of files scanned.
62: The number of directories scanned.
The following counters are updated during the comparison stage (what the differences are). A file or folder with the same name on both the source/left and destination/right is counted as one file or folder and not two. These are signed 32-bit integers.
1: The number of files that have been changed
2: The number of files whose contents have changed (hash values are different)
3: The number of files that are only in the destination/right
4: The number of files that are only in the source/left
63: The number of files that are in the source/left and destination/right
5: The number of files whose modification date & time have changed
6: The number of files whose size has changed
7: The number of files whose attributes have changed
8: The number of files whose name is same but the case has changed
9: The number of directories that have been changed
10: The number of directories that are only in destination/right
11: The number of directories that are only in source/left
12: The number of files that are identical files or only have versions
64: The number of files whose creation date & time have changed
65: The number of files whose NTFS file security have changed
68: The number of files whose last access date & time have changed
71: The number of files whose hard links changed
74: The number of files whose symbolic link changed
The following are comparison counters that indicate what is left to be done. They are set during the comparison stage and decremented as the profile runs. These are signed 32-bit integers.
13: The number of files to skip
14: The number of files to be prompted on
15: The number of files to delete from source/left
16: The number of files to delete from destination/right
17: The number of files to copy from source/left
18: The number of files to copy from destination/right
19: The number of files to move from source/left
20: The number of files to move from destination/right
21: The number of files in the source/left to have date & time, attributes, and/or case changed
22: The number of files in the destination/right to have date & time, attributes, and/or case changed
23: The number of files to restore old versions of in source/left
24: The number of files to restore old versions of in destination/right
25: The number of files to be renamed on the source/left
26: The number of files to be renamed on the destination/right
The following are comparison counters that indicate what is left to be done. They are set during the comparison stage and decremented as the profile runs. These are signed 64-bit integers.
27: The total number of bytes to be copied to the source/left. This includes files to be moved to the source/left.
28: The total number of bytes to be copied to the destination/right. This includes files to be moved to the destination/right.
29: The total number of bytes to delete from the source/left. This includes files to be moved to the destination/right.
30: The total number of bytes to delete from the destination/right. This includes files to be moved to the source/left.
The following are results counters that indicate what has been done so far. They are incremented while the profile is running. These are signed 32-bit integers.
31: The number of files skipped so far
32: The number of files and folders prompted on so far
33: The number of files and folders renamed on the source/left so far
34: The number of files and folders renamed on the destination/right so far
35: The number of files deleted from the source/left so far
36: The number of files deleted from the destination/right so far
37: The number of files copied from the source/left so far
38: The number of files copied from the destination/right so far
39: The number of files moved from the source/left so far
40: The number of files moved from the destination/right so far
41: The number of files on the source/left that so far have had their last modification date and time updated
42: The number of files on the destination/right that so far have had their last modification date and time updated
43: The number of files on the source/left that so far have had their attributes updated
44: The number of files on the destination/right that so far have had their attributes updated
45: The number of files on the source/left that so far have old versions restored
46: The number of files on the destination/right that so far have old versions restored
66: The number of files on the source/left that so far have had their security updated
67: The number of files on the destination/right that so far have had their security updated
69: The number of files on the source/left that so far have been versioned
70: The number of files on the destination/right that so far have been versioned
72: The number of hard links created on the source/left so far
73: The number of hard links created on the destination/right so far
75: The number of symbolic links created on the source/left so far
76: The number of symbolic links created on the destination/right so far
77: The number of files downloaded using HTTP instead of FTP
The following are bytes counters that indicate what has been done so far. They are incremented while the profile is running. These are signed 64-bit integers.
47: The total number of bytes copied to the source/left so far. This includes files being moved to the source/left.
48: The total number of bytes copied to the destination/right so far. This includes files being moved to the destination/right.
49: The total number of bytes deleted from the source/left so far. This includes files being moved from the source/left.
50: The total number of bytes deleted from the destination/right so far. This includes files being moved from the destination/right.
51: The total number of bytes replaced (overwritten) on the source/left so far.
52: The total number of bytes replaced (overwritten) on the destination/right so far.
The following are error counters that indicate the number of errors so far. They are incremented while the profile is running. These are signed 32-bit integers.
53: The total number of compression errors so far
54: The total number of files that have failed to be copied, deleted, or moved so far
55: The total number of files that cannot have their hash value calculated so far
56: The total number of non-critical errors so far (Deprecated: use 61 instead, for warnings)
61: The total number of warnings so far
The following are various values that are 64-bit signed integers.
57: The total number of bytes free initially on the source/left. This is set at the beginning of the profile and not updated. If the bytes free cannot be retrieved then -1 is returned.
58: The total number of bytes free initially on the destination/right. This is set at the beginning of the profile and not updated. If the bytes free cannot be retrieved then -1 is returned.
59: The number of files that will be updated. This is not changed once set.
60: The number of kilo-bytes that will be updated. This is not changed once set.
function GetStoredFileName(Filename, Left);
Filename: The filename (not including the base folder)
Left: If True then return the stored name of the left/source file
Return value: The files stored filename
This function is deprecated and will always return the folders name.
This function returns the stored (actual) filename of a file. Note that the filename should not include the base folder. If the file does not exist then an empty string is returned. If it doesn't have a stored name then it's normal filename is returned.
See the function GetStoredFolderName for information on what a stored name is.
See also GetFileDetailsEx
function GetStoredFolderName(Filename, Left);
Filename: The folder name (not including the base folder)
Left: If True then return the stored name of the left/source folder
Return value: The folders stored filename
This function is deprecated and will always return the folders name.
This function returns the stored (actual) name of a folder. Note that the filename should not include the base folder. If the folder does not exist then an empty string is returned. If it doesn't have a stored name then it's normal name is returned.
A folder may have a different name on one side, e.g. the right/destination name may be different from the left/source name.
For example:
GetStoredFolderName('\Folder\A long folder name\', FALSE);
may return "\FOLDER\ALONGFOL"
To get the stored name of a file use GetStoredFileName
function GetVersionDetails(Filename, Left, VersionNumber; var VersionFilename; var Size; var Attrs; var ModDateTime; var WhenVersioned);
Filename: The filename (not including the base folder)
Left: Pass True to get the details of the left/source file version
VersionFilename: The filename for the version of the file
Size: The size of the file in bytes (note this is a string if using VBScript)
Attr: The filesystem attributes of the file
ModDateTime: The last modification date & time of the file (local timezone)
WhenVersioned: When the version was created (local timezone)
Return value: False if the file version does not exist
This function is deprecated. Use GetVersionDetailsEx instead.
This function returns all the details of for a specific version of a file. Note that the filename should not include the base folder. Version numbers are zero based, with zero being the oldest version. Passing -1 as the version number will get you the newest version.
If the file or version does not exist then False is returned.
For example:
DoesNotExist:=SBRunning.GetVersionDetails(Filename, TRUE, 0, VersionName, Size, Attrs, ModDateTime, WhenVersioned);
See also GetFileVerCount and GetCurrentFileVer
function GetVersionDetailsEx(Filename, Left, VersionNumber; var VersionFilename; var Size; var Attrs; var ModDateTime; var CreateDateTime; var WhenVersioned; var VersionType);
Filename: The filename (not including the base folder)
Left: Pass True to get the details of the left/source file version
VersionFilename: The filename for the version of the file
Size: The size of the file in bytes (note this is a string if using VBScript)
Attr: The filesystem attributes of the file
ModDateTime: The last modification date & time of the file (local timezone)
CreateDateTime: The file creation date & time (local timezone)
WhenVersioned: When the version was created (local timezone)
VersionType: The type of version file. It could be a hash file, for example. See (TVerStoreType).
Return value: False if the file version does not exist
This function returns all the details of for a specific version of a file. Note that the filename should not include the base folder. Version numbers are zero based, with zero being the oldest version. Passing -1 as the version number will get you the newest version.
If the file or version does not exist then False is returned.
For example:
DoesNotExist:=SBRunning.GetVersionDetailsEx(Filename, TRUE, 0, VersionName, Size, Attrs, ModDateTime, CreateDateTime, WhenVersioned, VersionType);
See also GetFileVerCount and GetCurrentFileVer
function LeftAttribsToStr(Attrs);
Attrs: The attributes of the file or folder
Return value: The string representation of the attributes
Returns a string representation of the attributes of a file or folder. This use the location itself. For example, FTP attributes are not the same as Windows attributes.
See also RightAttribsToStr
function LeftFileExists(Filename);
Filename: The filename to check for
Return value: True if the file exists in the left/source
Returns True if the file exists in the left/source. Note that the filename should not include the base folder.
See also LeftFolderExists and RightFileExists
function LeftFolderExists(Name);
Name: The name of the folder to check for
Return value: True if the folder exists in the left/source
Returns True if the folder exists in the left/source. Note that the name should not include the base folder.
See also RightFolderExists and LeftFileExists
function RightAttribsToStr(Attrs);
Attrs: The attributes of the file or folder
Return value: The string representation of the attributes
Returns a string representation of the attributes of a file or folder. This use the location itself. For example, FTP attributes are not the same as Windows attributes.
See also LeftAttribsToStr
function RightFileExists(Filename);
Filename: The filename to check for
Return value: True if the file exists in the right/destination
Returns True if the file exists in the right/destination. Note that the filename should not include the base folder.
See also RightFolderExists and LeftFileExists
function RightFolderExists(Name);
Name: The name of the folder to check for
Return value: True if the folder exists in the right/destination
Returns True if the folder exists in the right/destination. Note that the name should not include the base folder.
See also LeftFolderExists and RightFileExists
function SetFileAttrs(Filename, Left, NewAttrs);
Filename: The filename (not including the base folder)
Left: Pass True to set the attributes of the left/source file
NewAttrs: The file attributes to set
Return value: The files attributes, or -1 on failure
This function sets the filesystem attributes of a file. Note that the filename should not include the base folder.
This function does not actually change the attributes of the file. It instead tells SyncBack what the attributes of the file are.
See also GetFileAttrs
function SetFileCreateDateTime(Filename, Left, NewAttrs);
Filename: The filename (not including the base folder)
Left: Pass True to set the date & time of the left/source file
NewDateTime: The date & time to use (local timezone)
Return value: The date & time of the file, or 1.0 on failure
This function sets the creation date & time of a file. Note that the filename should not include the base folder.
This function does not actually change the creation date & time of the file. It instead tells SyncBack what the creation date & time of the file is.
See also GetFileCreateDateTime
function SetFileDateTime(Filename, Left, NewAttrs);
Filename: The filename (not including the base folder)
Left: Pass True to set the date & time of the left/source file
NewDateTime: The date & time to use (local timezone)
Return value: The date & time of the file, or 1.0 on failure
This function sets the last modification date & time of a file. Note that the filename should not include the base folder.
This function does not actually change the last modification date & time of the file. It instead tells SyncBack what the last modification date & time of the file is.
See also GetFileDateTime
function SetFileHash(Filename, Left, NewHash);
Filename: The filename (not including the base folder)
Left: Pass True to set the hash value of the left/source file
NewHash: The CRC32 hash value of the file
Return value: The hash value of the file, or empty string on failure
This function sets the CRC32 hash value (string format) of a file. Note that the filename should not include the base folder.
This function does not actually change the hash value of the file. It instead tells SyncBack what the hash value of the file is. Note that the hash value is not used unless the profile is configured to use hashing for file comparisons.
See also GetFileHash
function SetFileNTFSSecurity(Filename, Left, NewNTFSSecurity);
Filename: The filename (not including the base folder)
Left: Pass True to set the security of the left/source file
NewNTFSSecurity: The NTFS security of the file
Return value: The NTFS security of the file, or empty string on failure
This function sets the NTFS security (string format) of a file. Note that the filename should not include the base folder.
This function does not actually change the security of the file. It instead tells SyncBack what the security of the file is.
See also GetFileNTFSSecurity
function SetFileSize(Filename, Left, NewSize);
Filename: The filename (not including the base folder)
Left: Pass True to set the size of the left/source file
NewSize: The size of the file
Return value: The size of the file, or -1 on failure
This function sets the size of a file. Note that the filename should not include the base folder. To avoid the 32-bit limit in VBScript the NewSize is a string, and so is the return value.
This function does not actually change the size of the file. It instead tells SyncBack what the size of the file is.
See also GetFileSize
function SetFileVersion(Filename, Left, NewVersion);
Filename: The filename (not including the base folder)
Left: Pass True to set the details of the left/source file
NewVersion: The version number to use
Return value: The current file version, -1 if an error occurred, or -2 if it isn't set to use a version
This function sets the current version of a file. Version numbers are zero based, with zero being the oldest version. Passing -1 as the version number will get you the newest version. Passing -2 as the version number will set it so no version is restored.
The only place you can change the version of a file is in the call to RunPreCopyCheck. If SetFileVersion is called before or after that point then the results are undefined.
You cannot change the current version of a file if the file is to be deleted or replaced, for example. In this case the function will return -1. It will also fail if you try and change the version to a delta hash file.
Note that the filenames do not include the base folder.
See the functions GetFileVerCount and GetCurrentFileVer
function SetFolderAttrs(Name, Left, NewAttrs);
Name: The folder (not including the base folder)
Left: Pass True to set the attributes of the left/source folder
NewAttrs: The folder attributes to set
Return value: The folder attributes, or -1 on failure
This function sets the filesystem attributes of a folder. Note that the path should not include the base folder.
This function does not actually change the attributes of the folder. It instead tells SyncBack what the attributes of the folder are.
See also GetFolderAttrs
function SetFolderCreateDateTime(Name, Left, NewDate);
Name: The folder (not including the base folder)
Left: Pass True to set the date & time of the left/source folder
NewDate: The creation date & time to use (local timezone)
Return value: The creation date & time of the folder, or 1.0 on failure
This function sets the creation date & time of a folder. Note that the path should not include the base folder.
This function does not actually change the creation date & time of the folder. It instead tells SyncBack what the creation date & time of the folder is.
See also GetFolderCreateDateTime
function SetFolderDateTime(Name, Left, NewDate);
Name: The folder (not including the base folder)
Left: Pass True to set the date & time of the left/source folder
NewDate: The modification date & time to use (local timezone)
Return value: The modification date & time of the folder, or 1.0 on failure
This function sets the modification date & time of a folder. Note that the path should not include the base folder.
This function does not actually change the modification date & time of the folder. It instead tells SyncBack what the modification date & time of the folder is.
See also GetFolderCreateDateTime
function SetFolderNTFSSecurity(Name, Left, NewSecurity);
Name: The folder (not including the base folder)
Left: Pass True to set the security of the left/source folder
NewSecurity: The NTFS security of the folder
Return value: The NTFS security of the folder, or empty string on failure
This function sets the NTFS security (string format) of a folder. Note that the path should not include the base folder.
This function does not actually change the security of the folder. It instead tells SyncBack what the security of the folder is.
See also GetFolderNTFSSecurity
Seconds: The number of seconds to sleep
Return value: True if the user has aborted the profile
Sleep for the specified number of seconds, but also checks to see if the profile has aborted while sleeping. If the user has aborted the profile run then the function returns True immediately, i.e. the sleep is aborted.
procedure CriticalError(Filename, TheError, IncErrorCount);
Filename: The filename of the file the error relates to
TheError: The error message
IncErrorCount: Pass True if the critical error count should be incremented
This subroutine records a critical error in the profiles log file. The error must be related to a particular file. Note that the filename should not include the base folder. For example, if the base folder is C:\My Files\, and the file is C:\My Files\Folder\Filename.txt, then the filename to pass should be \Folder\Filename.txt
A critical error means the profile has failed. The profile will continue running but once completed its last run status will be 'Failure'.
For example:
CriticalError('\folder\file.txt', 'Your wife says you cannot copy this file', TRUE);
See also NotCriticalError and Warning
procedure DebugOut(Str1, Str2, Level);
Str1: Typically this is a filename or refers to the object the error is about
Str2: Typically this is the error message
Level: The severity of the message
This subroutine records a message in the debug log. Note that nothing is recorded if debug output is not enabled. Level refers to the severity of the message (see below). The user can set the minimum level a message should be, e.g. they could filter out anything above level 5.
The debug levels are:
ELLError = 0
ELLWarning = 5
ELLInfo = 10
For example:
DebugOut('\folder\file.txt', 'Klingons off the starboard bow', ELLError);
To record a message in the Windows event log use EventOut
procedure EventOut(Msg, Level);
Msg: The message to record in the Windows event log
Level: The severity of the message
This subroutine records an event in the Windows Applications Event Log. Level refers to the severity of the message (1=error, 5=warning, 10=information). The even is only recorded if debug output is enabled.
The levels are:
ELLError = 0
ELLWarning = 5
ELLInfo = 10
For example:
EventOut('The toilet seat has not been left down', 1);
To record a message in the debug log for the profile use DebugOut
procedure Exception(ExceptionReport);
ExceptionReport: The exception report
This subroutine records an exception report in the profiles log file. An exception report is typically a number of lines of text that detail where an unexpected error occurred in the program/script. This is usally done when something serious unexpectedly happens in the program, e.g. an attempt is made to read from a nil pointer.
To record a message in the debug log for the profile use DebugOut
To record a message in the Windows event log use EventOut
procedure NotCriticalError(Filename, TheError);
Filename: The filename of the file the error relates to
TheError: The error message
This subroutine has been deprecated. Please use Warning instead.
See also CriticalError
This subroutine tells SyncBack that the computer should be rebooted aftet the profile has completed. For example, if a file can only be replaced on reboot then this subroutine should be called. Note that a reboot is not guaranteed to occur as the user may decide not to reboot.
procedure SysLogMessage(Msg, Severity);
Msg: The message to send to the SysLog server
Severity: The severity of the message (ranging from 0 to 7)
This subroutine sends a message to the SysLog server. Note that nothing is sent unless a SysLog server has been configured to be used. The severity is an integer value ranging from 0 (ESysLogEmergency) to 7 (ESysLogDebug).
The severity levels are:
ESysLogEmergency = The system is unusable
ESysLogAlert = Action must be taken immediately
ESysLogCritical = Critical conditions exist
ESysLogError = Error conditions exist
ESysLogWarning = Warning conditions exist
ESysLogNotice = Normal but significant condition
ESysLogInformational = Informative message
ESysLogDebug = Debug-level messages
For example:
SysLogMessage(Klingons off the starboard bow', ESysLogError);
To record a message in the Windows event log use EventOut
procedure Warning(Filename, TheWarning);
Filename: The filename of the file the warning relates to
TheError: The warning message
This subroutine records a warning message in the profiles log file. The warning must be related to a particular file. Note that the filename should not include the base folder. For example, if the base folder is C:\My Files\, and the file is C:\My Files\Folder\Filename.txt, then the filename to pass should be \Folder\Filename.txt
A warning does not mean the profile has failed.
For example:
Warning('\folder\file.txt', 'The file has your credit card number in it');
See also CriticalError
Returns TRUE if the profile is being aborted. Set it to TRUE to abort the profile. Note that the abort may not be immediate, and an abort cannot be aborted (i.e. once True you cannot change it to False).
Returns True if the profile is being run as a differential backup. If it is then that also implies it is a Fast Backup profile.
This property is read-only.
See also FastBackupType and DynamicFastBackup
Returns True if the profile is being run as a dynamnic fast backup backup.
This property is read-only.
See also FastBackupType and DifferentialBackup
Returns the type of Fast Backup the profile is being run as:
EFB_NONE = Not using Fast Backup
EFB_SYNCBACK = The original SyncBack Fast Backup method
EFB_ARCHIVE = Archive attribute Fast Backup
EFB_BACKUPEMAIL = Backup of email (not for POP3)
This property is read-only.
See also DynamicFastBackup and DifferentialBackup
Returns the number of files in the profile.
This property is read-only.
For the number of folders see FolderCount
Returns the number of folders (directories) in the profile.
This property is read-only.
For the number of folders see FileCount
Returns TRUE if this is a full-backup profile run. The value can be set to TRUE or FALSE, but note that any change to this value will only be relevant for the next run of the profile. Because of this any change made will not be reflected in reading the value, i.e. if FullBackup returns FALSE and you set it to TRUE then it will still return FALSE. You can check the current value by using GetProperty, e.g. SBVariables.GetProperty("S_FULLBACKUP", "N", True)
The setting will be automatically reset to FALSE after the profile has run (if it was a re-scan). Because of this it is recommend that you set the value in a call to RunProfileResult as this is called after any change the program makes to the value.
See also FastBackupType
Returns the name of the group profile, or empty string if the profile is not being run as part of a group.
This property is read-only.
See also VisualGroupName
Returns True if the profile is being run in integrity check mode. Note that when run in integrity check mode it is also considered a simulated run.
This property is read-only.
See also Simulated
Returns the abilities of the source/left location.
This property is read-only.
See also RightAbilities
Returns the left/source base folder, e.g. C:\My Files\To Backup\
This property is read-only.
See also RightFolder and LeftName
Returns TRUE if the source/left is the considered the source. Otherwise the destination/right is the source.
This property is read-only.
Returns the name of the left/source, e.g. My Files To Backup
This property is read-only.
See also RightName
Returns the type of the source/left location.
This property is read-only.
See also RightType
Returns the name of the profile.
This property is read-only.
See also GroupName and ProfileType
Returns the type of the profile.
This property is read-only.
See also ProfileTypeDesc
Returns a description of the profile based on its type (see ProfileType).
This property is read-only.
Returns True if the profile is being run in restore mode.
This property is read-only.
See also Simulated
Returns the abilities of the destination/right location.
This property is read-only.
See also LeftAbilities
Returns the right/destination base folder, e.g. C:\My Backup Files\
This property is read-only.
See also LeftFolder and RightName
Returns the name of the right/destination, e.g. My Backup Files
This property is read-only.
See also LeftName
Returns the type of the destination/right location.
This property is read-only.
See also LeftType
Returns True if the profile is being run in simulation mode.
This property is read-only.
See also Restore
Returns True if the profile is being run unattended, i.e. the script should not prompt the user or expect any user interaction.
This property is read-only.
If the profile is being run as part of a group, or it is being run from the user interface from within a group, then this is the name of the group. Note that the property GroupName is returned as an empty string if the profile is not being run as part of a group, but VisualGroupName may still return a group name if the user has clicked on the profile in a group and then run it.
This property is read-only.
All Content: 2BrightSparks Pte Ltd © 2003-2024