# Script Functions

A number of built-in scripting functions are available. See also [Script Classes](ScriptClasses.md).

**function CallWebhook(AUrl, AData);**

**AUrl:** The URL of the webhook

**AData:** The data to send to the webhook, which is typically in JSON format

**Return value:** Empty string on success else an error message

Call a webhook.

AUrl should be the full URL, e.g. https://www.example.xyz/abc?def=ghi

If AData is an empty string, then the call is a GET, else it is a POST

See also [CallWebhookEx](ScriptFunctions.md#function_callwebhookex_aurl__adata__var_aresponsetext__).

NOTE: Introduced in SyncBackPro V11.3.95.0

**function CallWebhookEx(AUrl, AData, var AResponseText);**

**AUrl:** The URL of the webhook

**AData:** The data to send to the webhook, which is typically in JSON format

**AResponseText:** Set to the response from the web server (on exception it is the error message)

**Return value:** The response code, e.g. 200, else -1 if an exception was raised

Call a webhook.

AUrl should be the full URL, e.g. https://www.example.xyz/abc?def=ghi

If AData is an empty string, then the call is a GET, else it is a POST

AResponseText is set to the response text.

See also [CallWebhook](ScriptFunctions.md#function_callwebhook_aurl__adata__).

NOTE: Introduced in SyncBackPro V11.3.95.0

**function Ceil(AValue);**

**AValue:** The value to round up

**Return value:** The smallest integer greater than or equal to AValue

Rounds a value up to the nearest integer.

For example, Ceil(3.1) returns 4, Ceil(-3.1) returns -3.

NOTE: Introduced in SyncBackPro V12

**function ChangeFileExt(AFilename, AExtension);**

**AFilename:** The original filename

**AExtension:** The new extension (including the dot)

**Return value:** The filename with the new extension

Changes the file extension of a filename.

For example, ChangeFileExt('MyFile.txt', '.bak') returns 'MyFile.bak'.

NOTE: Introduced in SyncBackPro V12

**function ContainsStr(AText, ASubText);**

**AText:** The string to search in

**ASubText:** The substring to search for

**Return value:** True if ASubText is found in AText (case-sensitive)

Returns True if the substring is found within the string. The comparison is case-sensitive.

NOTE: Introduced in SyncBackPro V12

**function ContainsText(AText, ASubText);**

**AText:** The string to search in

**ASubText:** The substring to search for

**Return value:** True if ASubText is found in AText (case-insensitive)

Returns True if the substring is found within the string. The comparison is case-insensitive.

NOTE: Introduced in SyncBackPro V12

**function CopyFile(FromFilename, ToFilename);**

**FromFilename:** The file to copy

**ToFilename:** The destination filename

**Return value:** On success 0 is returned, else a windows error code.

This function copies a file using SyncBack's internal copying routine (which gives progress feedback in the user interface).

See also [SysErrorMessage](ScriptFunctions.md#function_syserrormessage_winerrcode__).

**function CreateDir(ADirectory);**

**ADirectory:** The directory to create

**Return value:** True if the directory was created successfully

Creates a new directory. Returns True on success.

NOTE: Introduced in SyncBackPro V12

**function DateAdd(Interval, Number, ADate);**

**Interval:** The type of interval to add (e.g. "yyyy", "m", "d", "h", "n", "s")

**Number:** The number of intervals to add (can be negative)

**ADate:** The date to add to

**Return value:** The resulting date

VBScript compatible DateAdd function. Returns a date to which a specified time interval has been added.

The Interval parameter specifies the time interval:

"yyyy" = Year "q" = Quarter "m" = Month "y" = Day of year (same as "d") "d" = Day "w" = Weekday (same as "d") "ww" = Week "h" = Hour "n" = Minute "s" = Second

Number is the number of intervals to add. It can be negative to subtract. Date is the date to which the interval is added.

NOTE: Introduced in SyncBackPro V12

**function DateOf(ADateTime);**

**ADateTime:** The date and time to convert

**Return value:** A date without the time

Strips the time portion from a TDateTime value.

Call DateOf to convert a TDateTime value to a TDateTime value that includes only the date information (sets the time portion to 0, which means midnight).

Note: DateOf can yield an invalid result for TDateTime values that were manually calculated (using Arithmetics). In such a case, we recommend that you round the value (ex. DateOf(RoundTo(Value, -8))) prior to calling the DateOf routine.

NOTE: Introduced in SyncBackPro V11

**function DayOf(ADate);**

**ADate:** The date to get the day of

**Return value:** Day of the date

Returns the day of the month represented by a TDateTime value.

Call DayOf to obtain the day of the month represented by a specified TDateTime value. DayOf returns a value from 1 through 31.

NOTE: Introduced in SyncBackPro V11

**function DayOfTheWeek(ADate);**

**ADate:** The date

**Return value:** Day of week (1=Monday, 7=Sunday)

Returns the day of the week for a given date.

Returns a value from 1 to 7 where 1 is Monday and 7 is Sunday (ISO 8601).

NOTE: Introduced in SyncBackPro V12

**function DaysBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the years between Now and Then

Returns the number of whole days between two specified TDateTime values.

Call DaysBetween to obtain the difference, in days, between two TDateTime values.

DaysBetween counts only whole days. Thus, DaysBetween reports the difference between Dec 31, 1999 11:59 P.M. and Jan 1, 2000 11:58 P.M. as 0, because the difference is one minute short of an entire day.

DaysBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function DaysInAMonth(AYear, AMonth);**

**AYear:** The year

**AMonth:** The month of the year

**Return value:** The number of days in the specified month

Returns the number of days in a specified month of a specified year.

Call DaysInAMonth to obtain the number of days in the specified month of the specified year.

AYear is a year from 1 through 9999 (inclusive).

AMonth is a month from 1 through 12 (inclusive).

NOTE: Introduced in SyncBackPro V11

**function DaysInAYear(AYear);**

**AYear:** The year

**Return value:** The number of days in the specified year

Returns the number of days in a specified year.

Call DaysInAYear to obtain the number of days in the year specified by AYear. AYear is a year from 1 through 9999 (inclusive).

NOTE: Introduced in SyncBackPro V11

**function DaysInMonth(AValue);**

**AValue:** The date to check

**Return value:** The number of days in the specified month

Returns the number of days in the month of a specified TDateTime value.

Call DaysInMonth to obtain the number of days in the month of the TDateTime value specified by AValue.

NOTE: Introduced in SyncBackPro V11

**function DaysInYear(AValue);**

**AValue:** The date to check (with the year)

**Return value:** The number of days in the specified year

Returns the number of days in the year of a specified TDateTime value.

Call DaysInYear to obtain the number of days in the year of the TDateTime value specified by AValue.

NOTE: Introduced in SyncBackPro V11

**function DeleteFile(AFilename);**

**AFilename:** The file to delete

**Return value:** On success TRUE is returned

This function deletes a file. If the file does not exist TRUE is returned.

**function DirectoryExists(ADirectory);**

**ADirectory:** The directory path to check

**Return value:** True if the directory exists

Returns True if a directory exists.

NOTE: Introduced in SyncBackPro V12

**function DupeString(AText, ACount);**

**AText:** The string to duplicate

**ACount:** The number of copies

**Return value:** The duplicated string

Returns a string consisting of ACount copies of AText.

For example, DupeString('ab', 3) returns 'ababab'.

NOTE: Introduced in SyncBackPro V12

**function EndOfADay(AYear, AMonth, ADay);**

**AYear:** The year of the desired day

**AMonth:** The month of the desired day. AMonth can range from 1 through 12.

**ADay:** The day of the desired day. ADay can range from 1 through 28, 29, 30, or 31, depending on the values of AYear and AMonth.

**Return value:** End of the day

Returns a TDateTime that represents the last millisecond of a specified day.

EndOfADay returns the last expressible moment (11:59:59.999 P.M.) of a specified day.

If the parameters do not specify a valid date, EndOfADay raises an EConvertError exception.

See also [EndOfADay2](ScriptFunctions.md#function_endofaday2_ayear__adayofyear__).

NOTE: Introduced in SyncBackPro V11

**function EndOfADay2(AYear, ADayOfYear);**

**AYear:** The year of the desired day

**ADayOfYear:** The desired day as a day of the year, where 1 is January 1, 2 is January 2, 32 is February 1, and so on.

**Return value:** End of the day

Returns a TDateTime that represents the last millisecond of a specified day.

EndOfADay2 returns the last expressible moment (11:59:59.999 P.M.) of a specified day.

If the parameters do not specify a valid date, EndOfADay raises an EConvertError exception.

See also [EndOfADay](ScriptFunctions.md#function_endofaday_ayear__amonth__aday__).

NOTE: Introduced in SyncBackPro V11

**function EndOfAMonth(AYear, AMonth);**

**AYear:** The year of the desired month.

**AMonth:** The month. It can range from 1 through 12.

**Return value:** End of the month

Returns a TDateTime that represents the last millisecond of the last day of a specified month.

EndOfAMonth returns the last expressible moment (11:59:59.999 P.M.) of the last day of a specified month.

If the parameters do not specify a valid month, EndOfAMonth raises an EConvertError exception.

NOTE: Introduced in SyncBackPro V11

**function EndOfAWeek(AYear, AWeekOfYear, ADayOfWeek);**

**AYear:** The year of the desired day.

**AWeekOfYear:** The week of the year, where 1 is the first week in AYear that includes four or more days.

**ADayOfWeek:** The desired day in the specified week, where 1 is Monday, 2 is Tuesday, and so on.

**Return value:** End of the week

Returns a TDateTime object value that represents the last millisecond of a specified day of a specified week.

EndOfAWeek returns the last expressible moment (11:59:59.999 P.M.) of the specified day of the specified week.

If the parameters do not specify a valid date, EndOfAWeek raises an EConvertError exception.

Note: The definitions for AWeekOfYear and ADayOfWeek follow the ISO 8601 standard.

NOTE: Introduced in SyncBackPro V11

**function EndOfAYear(AYear);**

**AYear:** The year to get the end of

**Return value:** End of the year

Returns a TDateTime that represents the last millisecond of a specified year.

EndOfAYear returns the last expressible moment (December 31 at 11:59:59.999 P.M.) of the year specified by the AYear parameter.

NOTE: Introduced in SyncBackPro V11

**function EndOfTheDay(ADate);**

**ADate:** The date

**Return value:** End of the day

Returns a TDateTime that represents the last millisecond of the day identified by a specified TDateTime.

EndOfTheDay returns the last expressible moment of the same day as the TDateTime specified by ADate. That is, it replaces the time portion of ADate with 11:59:59.999 P.M. and returns the result.

NOTE: Introduced in SyncBackPro V11

**function EndOfTheMonth(ADate);**

**ADate:** The date to get the end of the month of

**Return value:** End of the month

Returns a TDateTime that represents the last millisecond of the last day of the month identified by a specified TDateTime.

EndOfTheMonth returns the last expressible moment of the same month as the TDateTime specified by ADate. That is, it replaces the time portion of AValue with 11:59:59.999 P.M., changes the day to the last day of the month, and returns the result.

NOTE: Introduced in SyncBackPro V11

**function EndOfTheWeek(ADate);**

**ADate:** The date

**Return value:** End of the week

Returns a TDateTime that represents the last millisecond of the last day of the week identified by a specified TDateTime.

EndOfTheWeek returns the last expressible moment of the same week as the TDateTime specified by ADate. That is, it replaces the time portion of ADate with 11:59:59.999 P.M., changes the day to the last day of the week, and returns the result.

Note: EndOfTheWeek defines the week of ADate according to the ISO 8601 standard. That is, the week starts on Monday and ends on Sunday.

NOTE: Introduced in SyncBackPro V11

**function EndOfTheYear(ADate);**

**ADate:** The date get the end of the year of

**Return value:** End of the year

Returns a TDateTime that represents the last millisecond of the last day of the year identified by a specified TDateTime.

EndOfTheYear returns the last expressible moment of the same year as the TDateTime specified by ADate. That is, it replaces the time portion of AValue with 11:59:59.999 P.M., changes the day to December 31, and returns the result.

NOTE: Introduced in SyncBackPro V11

**function EndsStr(ASubText, AText);**

**ASubText:** The string that AText must end with

**AText:** The string to check to see if it ends with ASubText

**Return value:** TRUE if AText ends with ASubText

EndsStr determines if string AText ends with substring ASubText using a case sensitive string comparison. Returns true if AText ends with ASubText.

For a case insensitive comparison, use the EndsText routine.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function EndsText(ASubText, AText);**

**ASubText:** The string that AText must end with

**AText:** The string to check to see if it ends with ASubText

**Return value:** TRUE if AText ends with ASubText

EndsText determines if string AText ends with substring ASubText using a case insensitive string comparison. Returns true if AText ends with ASubText.

For a case sensitive comparison, use the EndsStr routine.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function Escape(ToEscape);**

**ToEscape:** The string to escape

**Return value:** The escaped string

Equivalent to the VBScript Escape method (for escaping strings to they can be passed in a URL).

For an example, see SendResultViaTwitter.bas

**function ExcludeTrailingPathDelimiter(AFilename);**

**AFilename:** The filename to remove the trailing delimiter from

**Return value:** AFilename with trailing path delimiter removed

Returns a path name without a trailing delimiter.

ExcludeTrailingPathDelimiter returns AFilename, with the trailing path delimiter ('\') removed. If the last character in AFilename is not a delimiter, then AFilename is returned unchanged.

NOTE: Introduced in SyncBackPro V11.3.94.0

**function ExpandFileName(AFilename);**

**AFilename:** The filename (can be relative)

**Return value:** The fully qualified filename

Converts a relative filename to a fully qualified filename using the current directory.

NOTE: Introduced in SyncBackPro V12

**function ExtractFileDrive(AFilename);**

**AFilename:** The full path

**Return value:** The drive portion

Extracts the drive from a full filename.

For example, ExtractFileDrive('C:\Folder\MyFile.txt') returns 'C:'.

NOTE: Introduced in SyncBackPro V12

**function ExtractFileExt(AFilename);**

**AFilename:** The filename or full path

**Return value:** The file extension including the dot

Extracts the file extension (including the leading dot) from a filename.

For example, ExtractFileExt('MyFile.txt') returns '.txt'.

NOTE: Introduced in SyncBackPro V12

**function ExtractFileName(AFilename);**

**AFilename:** The full path

**Return value:** The filename portion

Extracts the filename (including extension) from a full path.

For example, ExtractFileName('C:\Folder\MyFile.txt') returns 'MyFile.txt'.

NOTE: Introduced in SyncBackPro V12

**function ExtractFilePath(AFilename);**

**AFilename:** The full path

**Return value:** The directory path including trailing backslash

Extracts the directory path from a full filename, including the trailing backslash.

For example, ExtractFilePath('C:\Folder\MyFile.txt') returns 'C:\Folder\'.

NOTE: Introduced in SyncBackPro V12

**function FileExists(Filename, IgnoreDirs);**

**Filename:** The file to check if exists

**IgnoreDirs:** If passed as TRUE, and the file is actually a directory, then FALSE is returned

**Return value:** TRUE if the file exists

Returns TRUE if file exists. This also returns TRUE if the folder exists, unless IgnoreDirs is TRUE. If the file is a symbolic link it only tests if the symbolic link exists and not the file the link points to.

See also [SysErrorMessage](ScriptFunctions.md#function_syserrormessage_winerrcode__).

NOTE: Introduced in SyncBackPro V11.3.108.0

**function FirstChar(AText);**

**AText:** The text to get the first character from

**Return value:** The first character of AText

FirstChar returns the first character in a string.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function Floor(AValue);**

**AValue:** The value to round down

**Return value:** The largest integer less than or equal to AValue

Rounds a value down to the nearest integer.

For example, Floor(3.9) returns 3, Floor(-3.9) returns -4.

NOTE: Introduced in SyncBackPro V12

**function GetObject(Pathname);**

**Pathname:** The class required

**Return value:** The class requested

Equivalent to the VBScript GetObject method, but with only one parameter.

For examples, see WaitForFinishEx.bas and CreateRestorePoint.bas

**function GetTempPath;**

**Return value:** The temporary files directory path

Returns the path of the temporary files directory.

NOTE: Introduced in SyncBackPro V12

**function HourOf(ADate);**

**ADate:** The date to get the hour of

**Return value:** Hour of the time

Returns the hour of the day represented by a TDateTime value.

Call HourOf to obtain the hour of the day represented by a specified TDateTime value. HourOf returns a value from 0 through 23.

NOTE: Introduced in SyncBackPro V11

**function HoursBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the hours between Now and Then

Returns the number of whole hours between two specified TDateTime values.

Call HoursBetween to obtain the difference, in hours, between two TDateTime values. HoursBetween counts only entire hours. Thus, HoursBetween reports the difference between 9:00 A.M. and 9:59:59 A.M. as 0 because the difference is one second short of an entire hour.

HoursBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function IncDay(ADate, NumberOfDays);**

**ADate:** The starting date

**NumberOfDays:** Number of days to add (can be negative)

**Return value:** The resulting date

Returns a date shifted by the specified number of days.

NOTE: Introduced in SyncBackPro V12

**function IncHour(ADate, NumberOfHours);**

**ADate:** The starting date/time

**NumberOfHours:** Number of hours to add (can be negative)

**Return value:** The resulting date/time

Returns a date/time shifted by the specified number of hours.

NOTE: Introduced in SyncBackPro V12

**function IncludeTrailingPathDelimiter(AFilename);**

**AFilename:** The filename to append the delimiter to

**Return value:** AFilename with appended path delimiter

IncludeTrailingPathDelimiter ensures that a path name ends with a trailing path delimiter ('\'). If AFilename already ends with a trailing delimiter character, it is returned unchanged; otherwise, AFilename is returned with an appended delimiter character.

NOTE: Introduced in SyncBackPro V11.3.94.0

**function IncMilliSecond(ADate, NumberOfMilliSeconds);**

**ADate:** The starting date/time

**NumberOfMilliSeconds:** Number of milliseconds to add (can be negative)

**Return value:** The resulting date/time

Returns a date/time shifted by the specified number of milliseconds.

NOTE: Introduced in SyncBackPro V12

**function IncMinute(ADate, NumberOfMinutes);**

**ADate:** The starting date/time

**NumberOfMinutes:** Number of minutes to add (can be negative)

**Return value:** The resulting date/time

Returns a date/time shifted by the specified number of minutes.

NOTE: Introduced in SyncBackPro V12

**function IncMonth(ADate, NumberOfMonths);**

**ADate:** The starting date

**NumberOfMonths:** Number of months to add (can be negative)

**Return value:** The resulting date

Returns a date shifted by the specified number of months.

NOTE: Introduced in SyncBackPro V12

**function IncSecond(ADate, NumberOfSeconds);**

**ADate:** The starting date/time

**NumberOfSeconds:** Number of seconds to add (can be negative)

**Return value:** The resulting date/time

Returns a date/time shifted by the specified number of seconds.

NOTE: Introduced in SyncBackPro V12

**function IncWeek(ADate, NumberOfWeeks);**

**ADate:** The starting date

**NumberOfWeeks:** Number of weeks to add (can be negative)

**Return value:** The resulting date

Returns a date shifted by the specified number of weeks.

NOTE: Introduced in SyncBackPro V12

**function IncYear(ADate, NumberOfYears);**

**ADate:** The starting date

**NumberOfYears:** Number of years to add (can be negative)

**Return value:** The resulting date

Returns a date shifted by the specified number of years.

NOTE: Introduced in SyncBackPro V12

**function IntToHex(AValue, ADigits);**

**AValue:** The integer value to convert

**ADigits:** The minimum number of hex digits

**Return value:** The hexadecimal string

Converts an integer to a hexadecimal string with the specified number of digits.

For example, IntToHex(255, 4) returns '00FF'.

NOTE: Introduced in SyncBackPro V12

**function IsAM(ATime);**

**ATime:** The to check

**Return value:** TRUE if the time is AM

Indicates whether the time portion of a specified TDateTime value occurs before noon.

IsAM returns True if the time portion of AValue occurs after 00:00 (midnight) and before or at 12:00 (noon).

NOTE: Introduced in SyncBackPro V11

**function IsInLeapYear(ADate);**

**ADate:** The date and time to check

**Return value:** TRUE if the date is in a leap year

Indicates whether a specified TDateTime value occurs in a leap year.

Call IsInLeapYear to determine whether the year of the date specified by ADateTime occurs in a leap year.

NOTE: Introduced in SyncBackPro V11

**function IsPM(ATime);**

**ATime:** The to check

**Return value:** TRUE if the time is PM

Indicates whether the time portion of a specified TDateTime value occurs in the afternoon.

IsPM returns True if the time portion of AValue occurs on or after 12:00 noon and before 00:00 midnight.

NOTE: Introduced in SyncBackPro V11

**function IsSameDay(ADate1, ADate2);**

**ADate1:** The date to check

**ADate2:** The date to compare to ADate1

**Return value:** True if the dates are the same day

Indicates whether a specified TDateTime value occurs on a the same day as a criterion date.

IsSameDay returns True if ADate1 occurs on the same day as ADate2. The time portions of ADate1 and ADate2 can differ.

IsSameDay returns False if the date portions of ADate1 and ADate2 differ.

NOTE: Introduced in SyncBackPro V11

**function IsToday(AValue);**

**AValue:** The date to check

**Return value:** True if the date is today

Indicates whether a specified TDateTime value occurs on the current date.

IsToday returns True if AValue occurs on the current day.

IsToday returns False if AValue represents a time on any other day.

NOTE: Introduced in SyncBackPro V11

**function IsValidDate(AYear, AMonth, ADay);**

**AYear:** The year

**AMonth:** The month of the year

**ADay:** The day of the month

**Return value:** TRUE if the date is valid

Indicates whether a specified year, month, and day represent a valid date.

IsValidDate returns True if:

- AYear falls in the range from 1 through 9999 inclusive. - AMonth falls in the range from 1 through 12 inclusive. - ADay falls in the range from 1 through the number of days in the specified month.

Otherwise, IsValidDate returns False.

NOTE: Introduced in SyncBackPro V11

**function IsValidDateDay(AYear, ADay);**

**AYear:** The year

**ADay:** The day of the year

**Return value:** TRUE if the year and day are valid

Indicates whether a specified year and day of the year represent a valid date.

IsValidDateDay returns True if:

- AYear falls in the range from 1 through 9999 inclusive. - ADay falls in the range from 1 through the number of days in the specified year.

Otherwise, IsValidDateDay returns False.

NOTE: Introduced in SyncBackPro V11

**function IsValidDateMonthWeek(AYear, AMonth, AWeekOfMonth, ADayOfWeek);**

**AYear:** The year

**AMonth:** The month of the year

**AWeekOfMonth:** The week of the month

**ADayOfWeek:** The day of the week

**Return value:** TRUE if it is valud

Indicates whether a specified year, month, week of the month, and day of the week represent a valid date.

IsValidDateMonthWeek returns True if:

- AYear falls in the range from 1 through 9999 inclusive. - AMonth falls in the range from 1 through 12 inclusive. - AWeekOfMonth falls in the range from 1 through the number of weeks in the specified month. - ADayOfWeek falls in the range from 1 through 7.

Otherwise, IsValidDateMonthWeek returns False.

NOTE: Introduced in SyncBackPro V11

**function IsValidDateTime(AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond);**

**AYear:** The year

**AMonth:** The month of the year

**ADay:** The day of the month

**AHour:** The hour of the day

**AMinute:** The minutor of the hour

**ASecond:** The second of the minute

**AMilliSecond:** The milli-second of the second

**Return value:** TRUE if the date and time is valid

Indicates whether a specified year, month, day, hour, minute, second, and millisecond represent a valid date and time.

IsValidDateTime returns True if:

- AYear falls in the range from 1 through 9999 inclusive. - AMonth falls in the range from 1 through 12 inclusive. - ADay falls in the range from 1 through the number of days in the specified month. - AHour falls in the range from 0 through 24, and if AHour is 24, then AMinute, ASecond, and AMilliSecond must all be 0. - AMinute falls in the range from 0 through 59 inclusive. - ASecond falls in the range from 0 through 59 inclusive. - AMilliSecond falls in the range from 0 through 999 inclusive.

Otherwise, IsValidDateTime returns False.

NOTE: Introduced in SyncBackPro V11

**function IsValidDateWeek(AYear, AWeekOfYear, ADayOfWeek);**

**AYear:** The year

**AWeekOfYear:** The week of the year

**ADayOfWeek:** The day of the week

**Return value:** TRUE if it is valud

Indicates whether a specified year, week of the year, and day of the week represent a valid date.

IsValidDateWeek returns true if:

- AYear falls in the range from 1 through 9999 inclusive. - AWeekOfYear falls in the range from 1 through the number of weeks in the specified year. - ADayOfWeek falls in the range from 1 through 7.

Otherwise, IsValidDateWeek returns False.

NOTE: Introduced in SyncBackPro V11

**function IsValidTime(AHour, AMinute, ASecond, AMilliSecond);**

**AHour:** The hour of the day

**AMinute:** The minutor of the hour

**ASecond:** The second of the minute

**AMilliSecond:** The milli-second of the second

**Return value:** TRUE if the time is valid

Indicates whether a specified hour, minute, second, and millisecond represent a valid date and time.

IsValidTime returns True if:

- AHour falls in the range from 0 through 24, and if AHour is 24, then AMinute, ASecond, and AMilliSecond must all be 0. - AMinute falls in the range from 0 through 59 inclusive. - ASecond falls in the range from 0 through 59 inclusive. - AMilliSecond falls in the range from 0 through 999 inclusive.

Otherwise, IsValidTime returns False.

NOTE: Introduced in SyncBackPro V11

**function LastChar(AText);**

**AText:** The text to get the last character from

**Return value:** The last character of AText

LastChar returns the last character in a string.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function LastDelimiter(ALastDelimiters, AString);**

**ALastDelimiters:** The delimiters to search AString for

**AString:** The string to search

**Return value:** The index of the last character that matches any delimiter

Returns the index of the last character that matches any character in a specified set of delimiters.

Call LastDelimiter to locate the last delimiter in a specified string.

ALastDelimiters is a string where each character is a valid delimiter.

AString is the string to search for delimiters.

Example:

```
MyIndex := LastDelimiter('\.:','c:\filename.ext');
```

NOTE: Introduced in SyncBackPro V11.2.26.0

**function LeftStr(AText, ACount);**

**AText:** The string to get the left (start) of

**ACount:** The number of characters

**Return value:** The left of the string

Returns the substring of a specified length that appears at the start of a string.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function Log10(AValue);**

**AValue:** The value (must be greater than 0)

**Return value:** The base-10 logarithm

Returns the base-10 logarithm of a value.

NOTE: Introduced in SyncBackPro V12

**function MatchesMask(AFilename, AMask);**

**AFilename:** The filename to check (can be any string, does not need to be a filename)

**AMask:** The mask

**Return value:** TRUE if the string matches the mask

Indicates whether a file name conforms to the format specified by a filter string.

Call MatchesMask to check the AFilename parameter using the AMask parameter to describe valid values. A valid mask consists of literal characters, sets, and wildcards.

Each literal character must match a single character in the string. The comparison to literal characters is case-insensitive.

Each set begins with an opening bracket ([) and ends with a closing bracket (]). Between the brackets are the elements of the set. Each element is a literal character or a range. Ranges are specified by an initial value, a dash (-), and a final value. Do not use spaces or commas to separate the elements of the set. A set must match a single character in the string. The character matches the set if it is the same as one of the literal characters in the set, or if it is in one of the ranges in the set. A character is in a range if it matches the initial value, the final value, or falls between the two values. All comparisons are case-insensitive. If the first character after the opening bracket of a set is an exclamation point (!), then the set matches any character that is not in the set.

Wildcards are asterisks (*) or question marks (?). An asterisk matches any number of characters. A question mark matches a single arbitrary character.

MatchesMask returns TRUE if the string matches the mask. MatchesMask returns FALSE if the string does not match the mask or MatchesMask raises an exception if the mask is syntactically invalid.

Note: The Filename parameter does not need to be a file name. MatchesMask can be used to check strings against any syntactically correct mask.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function Max(A, B);**

**A:** First value

**B:** Second value

**Return value:** The larger of the two values

Returns the larger of two values.

NOTE: Introduced in SyncBackPro V12

**function MidStr(AText, AStart, ACount);**

**AText:** The string to get the result from

**AStart:** The starting point in AText to get the characters from (first character is 1)

**ACount:** The number of characters to retrieve from AText

**Return value:** The string

Returns the substring of a specified length that appears at a specified position in a string.

MidStr returns a substring ACount characters at AText[AStart].

If AStart is larger than the length of AText, MidStr returns an empty string.

If ACount specifies more characters than are available, only the characters from AText[AStart] to the end of AText are returned.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function MilliSecondOf(ADate);**

**ADate:** The date to get the milli-second of

**Return value:** Milli-second of the time

Returns the millisecond of the second represented by a TDateTime value.

Call MilliSecondOf to obtain the millisecond of the second represented by a specified TDateTime value. MilliSecondOf returns a value from 0 through 999.

NOTE: Introduced in SyncBackPro V11

**function MilliSecondsBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the milli-seconds between Now and Then

Returns the number of milliseconds between two specified TDateTime values.

Call MilliSecondsBetween to obtain the difference, in milliseconds, between two TDateTime values.

MilliSecondsBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function Min(A, B);**

**A:** First value

**B:** Second value

**Return value:** The smaller of the two values

Returns the smaller of two values.

NOTE: Introduced in SyncBackPro V12

**function MinuteOf(ADate);**

**ADate:** The date to get the minute of

**Return value:** Minute of the time

Returns the minute of the hour represented by a TDateTime value.

Call MinuteOf to obtain the minute of the hour represented by a specified TDateTime value. MinuteOf returns a value from 0 through 59.

NOTE: Introduced in SyncBackPro V11

**function MinutesBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the minutes between Now and Then

Returns the number of minutes between two specified TDateTime values.

Call MinutesBetween to obtain the difference, in minutes, between two TDateTime values. MinutesBetween counts only entire minutes. Thus, MinutesBetween reports the difference between 9:00:00 A.M. and 9:00:59:999 A.M. as 0, because the difference is one millisecond short of an entire minute.

MinutesBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function MonthOf(ADate);**

**ADate:** The date to get the month of

**Return value:** Month of the date

Returns the month of the year represented by a TDateTime value.

Call MonthOf to obtain the month of the year represented by a specified TDateTime value. MonthOf returns a value from 1 through 12.

NOTE: Introduced in SyncBackPro V11

**function MonthsBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the months between Now and Then

Returns the approximate number of months between two specified TDateTime values.

Call MonthsBetween to obtain the difference, in months, between two TDateTime values. Because months are not all the same length, MonthsBetween returns an approximation based on an assumption of 30.4375 days per month. Fractional months are not counted. Thus, for example, MonthsBetween reports the difference between February 1 and March 1 as 0.

MonthsBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function MoveFile(FromFilename, ToFilename, CanCopy, var MoveOnReboot, FailIfExists);**

**FromFilename:** The file to rename

**ToFilename:** The new filename (where to move it to)

**CanCopy:** Allow copy and delete if cannot do move

**MoveOnReboot:** Allow move on reboot? If passed as TRUE, and is returned as FALSE, then no reboot is required.

**FailIfExists:** Fail if ToFilename already exists

**Return value:** On success 0 is returned, else a windows error code.

This function moves (renames) a file. The move uses SyncBack's internal moving routine (which gives progress feedback in the user interface).

See also [SysErrorMessage](ScriptFunctions.md#function_syserrormessage_winerrcode__).

NOTE: Introduced in SyncBackPro V11.3.108.0

**function PosEx(ASubStr, AString, AOffset);**

**ASubStr:** The string to search AString for

**AString:** The string to search

**AOffset:** The start point in AString to search (first characters is 1)

**Return value:** The index of the first occurrence of a substring within a string or zero if not found or AOffset is invalid

Returns the index of the first occurrence of a substring within a string.

PosEx returns the index of ASubStr in AString, beginning the search at AOffset.

If AOffset is 1, PosEx is equivalent to Pos.

If ASubStr is not found or AOffset is invalid (greater than the length of AString or less than 1), then the result is 0.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function Power(Base, Exponent);**

**Base:** The base value

**Exponent:** The exponent

**Return value:** Base raised to the power of Exponent

Raises Base to the specified exponent.

For example, Power(2, 10) returns 1024.

NOTE: Introduced in SyncBackPro V12

**function RandomRange(AFrom, ATo);**

**AFrom:** The minimum value (inclusive)

**ATo:** The maximum value (exclusive)

**Return value:** A random integer in the range

Returns a random integer within the specified range [AFrom, ATo).

The value returned is greater than or equal to AFrom and strictly less than ATo.

NOTE: Introduced in SyncBackPro V12

**function ReadStringFromFile(AFilename);**

**AFilename:** The filename of the file to read

**Return value:** The contents of the file

Returns the contents of a textual file as a string.

ReadStringFromFile reads the contents of a textual file and returns a string containing the text read from the file.

ReadStringFromFile first reads the preamble bytes from the beginning of the AFilename textual file. Then ReadStringFromFile skips the preamble bytes and reads the contents of the textual file beginning from this offset. ReadStringFromFile returns a string containing the text read from the file.

If the AFilename file does not contain a byte order mark for one of the standard encodings, the Default standard encoding is accepted and corresponding number of bytes is skipped.

ReadStringFromFile raises an exception if the file cannot be opened or the path is invalid.

A preamble is a sequence of bytes that specifies the encoding used. It is known as Byte Order Mark (BOM).

Use WriteStringToFile to write a string to a file.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function RemoveDir(ADirectory);**

**ADirectory:** The directory to remove (must be empty)

**Return value:** True if the directory was removed successfully

Removes an empty directory. Returns True on success.

NOTE: Introduced in SyncBackPro V12

**function RenameFile(AOldName, ANewName);**

**AOldName:** The current filename

**ANewName:** The new filename

**Return value:** True if the file was renamed successfully

Renames a file. Returns True on success.

NOTE: Introduced in SyncBackPro V12

**function ReplaceStr(AText, AFromText, AToText);**

**AText:** The original text to replace

**AFromText:** The text in AText to be replaced

**AToText:** The text to replace AFromText in AText with

**Return value:** The string with the replaced text

ReplaceStr replaces all instances of string AFromText to string AToText in the source string AText and returns this value as the result. The replacement is case sensitive.

For a case insensitive replacement, use the ReplaceText routine.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function ReplaceText(AText, AFromText, AToText);**

**AText:** The original text to replace

**AFromText:** The text in AText to be replaced

**AToText:** The text to replace AFromText in AText with

**Return value:** The string with the replaced text

ReplaceText replaces all instances of string AFromText to string AToText in the source string AText and returns this value as the result. The replacement is case insensitive.

For a case sensitive replacement, use the ReplaceStr routine.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function ReverseString(AText);**

**AText:** The string to reverse

**Return value:** The reversed string

Returns a reversed copy of the string.

For example, ReverseString('Hello') returns 'olleH'.

NOTE: Introduced in SyncBackPro V12

**function RightStr(AText, ACount);**

**AText:** The string to get the right (end) of

**ACount:** The number of characters

**Return value:** The end of the string

Returns the substring of a specified length that appears at the end of a string.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function RoundTo(AValue, ADigit);**

**AValue:** The value to round

**ADigit:** The power of ten to which you want AValue rounded. It can be any value in the range from -20 through 20.

**Return value:** The rounder value

Rounds a floating-point value to a specified digit or power of ten using "Banker's rounding".

Call RoundTo to round AValue to a specified power of ten.

RoundTo uses "Banker's Rounding" to determine how to round values that are exactly midway between the two values that have the desired number of significant digits. This method rounds to an even number in the case that AValue is not nearer to either value.

NOTE: Introduced in SyncBackPro V11

**function SecondOf(ADate);**

**ADate:** The date to get the second of

**Return value:** Second of the time

Returns the second of the minute represented by a TDateTime value.

Call SecondOf to obtain the second of the minute represented by a specified TDateTime value. SecondOf returns a value from 0 through 59.

NOTE: Introduced in SyncBackPro V11

**function SecondsBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the seconds between Now and Then

Returns the number of seconds between two specified TDateTime values.

Call SecondsBetween to obtain the difference, in seconds, between two TDateTime values. SecondsBetween counts only entire seconds. Thus, SecondsBetween reports the difference between 9:00:00 A.M. and 9:00:00:999 A.M. as 0, because the difference is one millisecond short of an entire second.

SecondsBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function StartOfADay(AYear, AMonth, ADay);**

**AYear:** The year of the desired day

**AMonth:** The month of the desired day. AMonth can range from 1 through 12.

**ADay:** The day of the desired day. ADay can range from 1 through 28, 29, 30, or 31, depending on the values of AYear and AMonth.

**Return value:** Start of the day

Returns a TDateTime that represents 12:00:00:00 A.M. on a specified day.

StartOfADay returns the first expressible moment (12:00:000 A.M.) of a specified day.

If the parameters do not specify a valid date, StartOfADay raises throws an EConvertError exception.

See also [StartOfADay2](ScriptFunctions.md#function_startofaday2_ayear__adayofyear__).

NOTE: Introduced in SyncBackPro V11

**function StartOfADay2(AYear, ADayOfYear);**

**AYear:** The year of the desired day

**ADayOfYear:** The desired day as a day of the year, where 1 is January 1, 2 is January 2, 32 is February 1, and so on.

**Return value:** Start of the day

Returns a TDateTime that represents 12:00:00:00 A.M. on a specified day.

StartOfADay2 returns the first expressible moment (12:00:000 A.M.) of a specified day.

If the parameters do not specify a valid date, StartOfADay raises throws an EConvertError exception.

See also [StartOfADay](ScriptFunctions.md#function_startofaday_ayear__amonth__aday__).

NOTE: Introduced in SyncBackPro V11

**function StartOfAMonth(AYear, AMonth);**

**AYear:** The year of the desired month.

**AMonth:** The month. It can range from 1 through 12.

**Return value:** Start of the month

Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of a specified month.

StartOfAMonth returns the first expressible moment (12:00:000 A.M.) of the first day of a specified month.

If the parameters do not specify a valid month, StartOfAMonth raises an EConvertError exception.

NOTE: Introduced in SyncBackPro V11

**function StartOfAWeek(AYear, AWeekOfYear, ADayOfWeek);**

**AYear:** The year of the desired day.

**AWeekOfYear:** The week of the year, where 1 is the first week in AYear that includes four or more days.

**ADayOfWeek:** The desired day in the specified week, where 1 is Monday, 2 is Tuesday, and so on.

**Return value:** Start of the week

Returns a TDateTime that represents the first moment on a specified day of a specified week.

StartOfAWeek returns the first expressible moment (12:00:00.000 A.M.) of the specified day of the specified week.

If the parameters do not specify a valid date, StartOfAWeek raises an EConvertError exception.

Note: The definitions for AWeekOfYear and ADayOfWeek follow the ISO 8601 standard.

NOTE: Introduced in SyncBackPro V11

**function StartOfAYear(AYear);**

**AYear:** The year to get the start of

**Return value:** Start of the year

Returns a TDateTime that represents the first moment on the first day of a specified year.

StartOfAYear returns the first expressible moment (January 1 at 12:00:00.000 A.M.) of the year specified by the AYear parameter.

NOTE: Introduced in SyncBackPro V11

**function StartOfTheDay(ADate);**

**ADate:** The date

**Return value:** Start of the day

Returns a TDateTime that represents 12:00:00:00 A.M. on the day identified by a specified TDateTime.

StartOfTheDay returns the first expressible moment of the same day as the TDateTime specified by ADate. That is, it replaces the time portion of ADate with 0 and returns the result.

NOTE: Introduced in SyncBackPro V11

**function StartOfTheMonth(ADate);**

**ADate:** The date to get the start of the month of

**Return value:** Start of the month

Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of the month identified by a specified TDateTime.

StartOfTheMonth returns the first expressible moment of the same month as the TDateTime specified by ADate. That is, it replaces the time portion of AValue with 0, changes the day to 1, and returns the result.

NOTE: Introduced in SyncBackPro V11

**function StartOfTheWeek(ADate);**

**ADate:** The date

**Return value:** Start of the week

Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of the week identified by a specified TDateTime.

StartOfTheWeek returns the first expressible moment of the same week as the TDateTime specified by ADate. That is, it replaces the time portion of ADate with 0, changes the day to Monday, and returns the result.

Note: StartOfTheWeek defines the week of ADate according to the ISO 8601 standard. That is, the week starts on Monday and ends on Sunday.

NOTE: Introduced in SyncBackPro V11

**function StartOfTheYear(ADate);**

**ADate:** The date to get the start of the year of

**Return value:** Start of the year

Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of the year identified by a specified TDateTime.

StartOfTheYear returns the first expressible moment of the same year as the TDateTime specified by ADate. That is, it replaces the time portion of AValue with 0, changes the day to January 1, and returns the result.

NOTE: Introduced in SyncBackPro V11

**function StartsStr(ASubText, AText);**

**ASubText:** The string that AText must start (begin) with

**AText:** The string to check to see if it starts with ASubText

**Return value:** TRUE if AText begins/starts with ASubText

StartsStr determines if the substring ASubText begins the string AText using a case sensitive algorithm. If ASubText matches the beginning of AText, the result is true, otherwise it is false.

For a case insensitive comparison, use the StartsText routine.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function StartsText(ASubText, AText);**

**ASubText:** The string that AText must start (begin) with

**AText:** The string to check to see if it starts with ASubText

**Return value:** TRUE if AText begins/starts with ASubText

StartsText determines if the substring ASubText begins the string AText using a case insensitive algorithm. If ASubText matches the beginning of AText, the result is true, otherwise it is false.

For a case sensitive comparison, use the StartsStr routine.

NOTE: Introduced in SyncBackPro V11.2.26.0

**function StringOfChar(ACh, ACount);**

**ACh:** The character to repeat (first character of the string is used)

**ACount:** The number of repetitions

**Return value:** The resulting string

Returns a string consisting of ACount copies of character ACh.

For example, StringOfChar('*', 10) returns '**'.

NOTE: Introduced in SyncBackPro V12

**function SysErrorMessage(WinErrCode);**

**WinErrCode:** The windows error code

**Return value:** Returns the Windows error message for the error code

Returns the Windows error message for the Windows error code.

**function TimeOf(ADateTime);**

**ADateTime:** The date and time to convert

**Return value:** A time without the date

Strips the date portion from a TDateTime value.

Call TimeOf to convert a TDateTime value to a TDateTime value that includes only the time information (sets the date portion to 0, which means 12/30/1899).

Note: TimeOf can yield an invalid result for TDateTime values that were manually calculated (using Arithmetics). In such a case, we recommend that you round the value (ex. TimeOf(RoundTo(Value, -8))) prior to calling the TimeOf routine.

NOTE: Introduced in SyncBackPro V11

**function Today;**

**Return value:** The current date (no time)

Returns a TDateTime value that represents the current date.

Today returns a TDateTime value with the date portion set to the current date and the time portion set to 0.

NOTE: Introduced in SyncBackPro V11

**function Tomorrow;**

**Return value:** Tomorrows date (no time)

Returns a TDateTime value that represents the following day.

Tomorrow returns a TDateTime value with the date portion set to the day following the current date and the time portion set to 0.

NOTE: Introduced in SyncBackPro V11

**function VarToInt64(ToConvert);**

**ToConvert:** The variable to convert to a 64-bit integer

**Return value:** A 64-bit integer, or 0 if the variable cannot be converted

This function converts values returned from scripting components to 64-bit integers. For example, use it with the Files property in FileSystemObject on the file size.

**function WeekOf(ADate);**

**ADate:** The date to get the week of

**Return value:** Week of the date

Returns the week of the year represented by a TDateTime value.

Call WeekOf to obtain the week of the year represented by a specified TDateTime value. WeekOf returns a value from 1 through 53.

WeekOf uses the ISO 8601 standard to define the week of the year. That is, a week is defined as running from Monday through Sunday, and the first week of the year is the one that includes the first Thursday of the year (the first week that includes four or more days in the year). This means that if the first calendar day of the year is a Friday, Saturday, or Sunday, then for the first three, two, or one days of the calendar year, WeekOf returns the last week of the previous year. Similarly, if the last calendar day of the year is a Monday, Tuesday, or Wednesday, then for the last one, two, or three days of the calendar year, WeekOf returns 1 (the first week of the next calendar year).

NOTE: Introduced in SyncBackPro V11

**function WeeksBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the weeks between Now and Then

Returns the number of whole weeks between two specified TDateTime values.

Call WeeksBetween to obtain the difference, in weeks, between two TDateTime values. WeeksBetween counts only whole Weeks. Thus, WeeksBetween reports the difference between January 1 at 12:00 A.M. and Jan 6 at 11:58 P.M. as 0, because the difference is one minute short of an entire week.

WeeksBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function WeeksInAYear(AYear);**

**AYear:** The year

**Return value:** The number of weeks in the specified year

Returns the number of weeks in a specified year.

Call WeeksInAYear to obtain the number of weeks in the year specified by AYear. AYear is a year from 1 through 9999 (inclusive).

Note: WeeksInAYear defines the first week of the year according to the ISO 8601 standard. That is, the first week of the year is the one that includes the first Thursday of the year (the first week that has four or more days in the year). This means that WeeksInAYear always returns either 52 or 53.

NOTE: Introduced in SyncBackPro V11

**function WeeksInYear(ADate);**

**ADate:** The date to check (with the year)

**Return value:** The number of weeks in the specified year

Returns the number of weeks in the year of a specified TDateTime value.

Call WeeksInYear to obtain the number of weeks in the year of the TDateTime value specified by AValue.

Note: WeeksInYear defines the first week of the year according to the ISO 8601 standard. That is, the first week of the year is the one that includes the first Thursday of the year (the first week that has four or more days in the year). This means that WeeksInYear always returns either 52 or 53.

NOTE: Introduced in SyncBackPro V11

**function YearOf(ADate);**

**ADate:** The date to get the year of

**Return value:** Year of the date

Returns the year represented by a TDateTime value.

Call YearOf to obtain the year represented by a specified TDateTime value. YearOf returns a value from 1 through 9999.

NOTE: Introduced in SyncBackPro V11

**function YearsBetween(Now, Then);**

**Now:** Date and time 1

**Then:** Date and time 2

**Return value:** Returns the years between Now and Then

Returns the approximate number of years between two specified TDateTime values.

Call YearsBetween to obtain the difference, in years, between two TDateTime values. Because years are not all the same length (e.g. leap years), YearsBetween returns an approximation based on an assumption of 365.25 days per year. Fractional years are not counted. Thus, for example, YearsBetween reports the difference between January 1 and December 31 as 0 on non-leap years and 1 on leap years.

YearsBetween always returns a positive result and therefore the parameter values are interchangeable.

This function was introduced in SyncBackPro V10.2.59.0

**function Yesterday;**

**Return value:** Yesterdays date (no time)

Returns a TDateTime value that represents the preceding day.

Yesterday returns a TDateTime value with the date portion set to the day before the current date and the time portion set to 0.

NOTE: Introduced in SyncBackPro V11

**procedure WriteStringToFile(AFilename, AText);**

**AFilename:** The filename of the file to write to

**AText:** The text to put into the file

Encodes the given Contents text and writes the obtained text into the AFilename text file.

WriteStringToFile first creates the AFilename file, then encodes the specified AText string using the UTF8 encoding, and then writes the encoded string into the created text file.

If the file specified by the AFilename parameter exists, it is overwritten; otherwise the file is created and filled with the given text.

WriteStringToFile raises an exception if the file cannot be accessed or the path is invalid.

Use ReadStringFromFile to read the contents of a file.

NOTE: Introduced in SyncBackPro V11.2.26.0

All Content: 2BrightSparks Pte Ltd © 2003-2026
