SBLocation

<< Click to Display Table of Contents >>

Navigation:  Using SyncBackPro > Technical Reference > Scripting >

SBLocation

 

These are functions that can be accessed from scripts via the SBLocation object. For example:

 

SBLocation.BaseDir

 

The SBLocation object is only accessible from Location scripts.

 

All the example code below is written in using the Pascal scripting language.

 


function AddDir(Name);

 

Name: The name of the directory, without the path

 

Return value: Return FALSE if the script wants to abort the scan

 

This function should be called by the Script inside the LocScanList whenever a new directory (folder) is found, i.e. the script must call this function for every directory in the directory being scanned.

 

It is recommended that you use the newer AddDirEx2 function instead of this function.

 

Name: The name should not include the path. It is just the name of the directory. It must be a unique name for that folder, i.e. two sub-directories in the same directory cannot have the same name. Note that you do not need to pass the special folders . or ..

 

 

function AddDirEx(Name, Attrs);

 

Name: The name of the directory, without the path

Attrs: The directories attributes

 

Return value: Return FALSE if the script wants to abort the scan

 

This function should be called by the Script inside the LocScanList whenever a new directory (folder) is found, i.e. the script must call this function for every directory in the directory being scanned.

 

It is recommended that you use the newer AddDirEx2 function instead of this function.

 

Attrs: The filesystem attributes of the directory. If the attributes are unknown then pass -1. Note that these must be standard Windows filesystem attributes.

 

Name: The name should not include the path. It is just the name of the directory. It must be a unique name for that folder, i.e. two sub-directories in the same directory cannot have the same name. Note that you do not need to pass the special folders . or ..

 

 

function AddDirEx2(Name, Attrs, ModDateTime, CreateDateTime, NTFSSec);

 

Name: The name of the directory, without the path

Attrs: The directories attributes

ModDateTime: The last modification date & time of the directory, or 1.0 if unknown

CreateDateTime: The creation date & time of the directory, or 1.0 if unknown

NTFSSec: The NTFS security of the directory, or empty string if unknown

 

Return value: Return FALSE if the script wants to abort the scan

 

This function should be called by the Script inside the LocScanList whenever a new directory (folder) is found, i.e. the script must call this function for every directory in the directory being scanned.

 

Name: The name should not include the path. It is just the name of the directory. It must be a unique name for that folder, i.e. two sub-directories in the same directory cannot have the same name. Note that you do not need to pass the special folders . or ..

 

Attrs: The filesystem attributes of the directory. If the attributes are unknown then pass -1. Note that these must be standard Windows filesystem attributes.

 

ModDateTime: The last modification date & time of the directory (in the local timezone). If the last modification date & time is unknown then pass 1.0.

 

CreateDateTime: The creation date & time of the directory (in the local timezone). If the creation date & time is unknown then pass 1.0.

 

NTFSSec: The NTFS security for the directory in string format. See the Win32 API function ConvertSecurityDescriptorToStringSecurityDescriptor. If the NTFS security is unknown or not applicable pass an empty string.

 

 

function AddFile(Name, CRC32, FileSize, Attrs, ModDateTime);

 

Name: The name of the file, without the path

CRC32: The CRC32 hash value of the file, or empty string if unknown

FileSize: The size of the file, in bytes, or -1 if unknown

Attrs: The filesystem attributes of the file, or -1 if unknown

ModDateTime: The last modification date & time of the file, or 1.0 if unknown

 

Return value: Return FALSE if the script wants to abort the scan

 

This function should be called by the Script inside the LocScanList function whenever a new file is found, i.e. the script must call this function for every file in the folder being scanned.

 

It is recommended that you use the newer AddFileEx function instead of this function.

 

Name: The name should not include the path. It is just the name of the file. It must be a unique name for that folder, i.e. two files in the same folder cannot have the same name.

 

CRC32: Do not waste time calculating the CRC32 hash value. Only provide it if it is already known, e.g. it's a Zip file so you can get the hash value quickly, otherwise pass an empty string.

 

FileSize: The size of the file, in bytes. If the size is unknown then pass -1. If IsIgnoringSize is returning True, and retrieving the file size would incur more processing time, then you can pass -1. When using VBScript this parameter is a string to avoid the 32-bit limit on integers used by VBScript. If you are using VBScript, then convert the number to a currency and then to a string, e.g. CFileSize = CStr(CCur(FileItem.Size))

 

Attrs: The filesystem attributes of the file. If the attributes are unknown then pass -1. Note that these must be standard Windows filesystem attributes.

 

ModDateTime: The last modification date & time of the file (in the local timezone). If the last modification date & time is unknown then pass 1.0. Also, if IsIgnoringDateTime is returning True, and retrieving the date & time would incur more processing time, then you can pass 1.0

 

 

function AddFileEx(Name, CRC32, FileSize, Attrs, ModDateTime, CreateDateTime, NTFSSec);

 

Name: The name of the file, without the path

CRC32: The CRC32 hash value of the file, or empty string if unknown

FileSize: The size of the file, in bytes, or -1 if unknown

Attrs: The filesystem attributes of the file, or -1 if unknown

ModDateTime: The last modification date & time of the file, or 1.0 if unknown

CreateDateTime: The creation date & time of the file, or 1.0 if unknown

NTFSSec: The NTFS security of the file, or empty string if unknown

 

Return value: Return FALSE if the script wants to abort the scan

 

This function should be called by the Script inside the LocScanList function whenever a new file is found, i.e. the script must call this function for every file in the folder being scanned.

 

Name: The name should not include the path. It is just the name of the file. It must be a unique name for that folder, i.e. two files in the same folder cannot have the same name.

 

CRC32: Do not waste time calculating the CRC32 hash value. Only provide it if it is already known, e.g. it's a Zip file so you can get the hash value quickly, otherwise pass an empty string.

 

FileSize: The size of the file, in bytes. If the size is unknown then pass -1. If IsIgnoringSize is returning True, and retrieving the file size would incur more processing time, then you can pass -1. When using VBScript this parameter is a string to avoid the 32-bit limit on integers used by VBScript. If you are using VBScript, then convert the number to a currency and then to a string, e.g. CFileSize = CStr(CCur(FileItem.Size))

 

Attrs: The filesystem attributes of the file. If the attributes are unknown then pass -1. Note that these must be standard Windows filesystem attributes.

 

ModDateTime: The last modification date & time of the file (in the local timezone). If the last modification date & time is unknown then pass 1.0. Also, if IsIgnoringDateTime is returning True, and retrieving the date & time would incur more processing time, then you can pass 1.0

 

CreateDateTime: The creation date & time of the file (in the local timezone). If the creation date & time is unknown then pass 1.0.

 

NTFSSec: The NTFS security for the file in string format. See the Win32 API function ConvertSecurityDescriptorToStringSecurityDescriptor. If the NTFS security is unknown or not applicable pass an empty string.

 

 

Property Abort

 

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).

 

 

Property BaseDir

 

Returns the base directory of the location.

 

This is a read-only property.

 

 

Property IsIgnoringDateTime

 

Returns True if this location can ignore file last modification date & times. Note that this should only be used in the LocScanList script function otherwise the return value is always False. This can be used to optimize the location, e.g. if it takes time to get a files last modification date & time, and IsIgnoringDateTime is returning True, then the script should not waste time trying to retrieve it (in the LocScanList script function).

 

This is a read-only property.

 

 

Property IsIgnoringSize

 

Returns True if this location can ignore file sizes. Note that this should only be used in the LocScanList script function otherwise the return value is always False. This can be used to optimize the location, e.g. if it takes time to get a files size, and IsIgnoringSize is returning True, then the script should not waste time trying to retrieve it (in the LocScanList script function).

 

This is a read-only property.

 

 

Property IsLeft

 

Returns True if this location is the left/source location, otherwise it is the right/destination location.

 

This is a read-only property.

 

 

Property VersionsType

 

Returns an integer value that states what is being done with versions folders:

 

EVTAsNormal = They are being treated as any other directory (usually because neither location if using versioning)

EVTSkip = Versions directories and being skipped and assumed not to exist (usually because this location doesn't use versioning, but the other one does)

EVTCollectSub = File versions are being read from the versions directories, i.e. the location uses versioning

EVTCollectRoot = File versions are being read from a sub-folder of the base folder

 

Note that this information is for reference only as SyncBack will manage all aspects of versioning for the script.

 

This is a read-only property.

 

 

Property VersionSubDir

 

Returns the name of the versions sub-folder, e.g. $SBV$. Note that this information is for reference only as SyncBack will manage all aspects of versioning for the script.

 

This is a read-only property.

 

 

 

 

 

All Content: 2BrightSparks Pte Ltd © 2003-2024