FILESIZE( ) function

Returns the size of the specified file in bytes.

Syntax

FILESIZE(filename)

Parameters

filename

Character. The name of the file to check the size of. If the file is in the same folder as the ACL project, you do not need to specify the full path. For files in other folders, either enter a relative path (e.g., results\test_output.fil), or an absolute path (e.g., c:\results\test_output.fil).

Output

Numeric. The value returned is the size of a file in bytes, or -1 if the file does not exist.

Remarks

You can use this function to determine the size of a file in bytes, or to check whether the file exists. You need to specify the physical data file name (.fil) for ACL tables, not the table name.

Examples

a. Only execute a script if a file does not exist

To execute the script called import_data only if the file Metaphor_Inventory_2002.fil does not exist, enter the following command:

DO SCRIPT import_data IF FILESIZE("Metaphor_Inventory_2002.fil") = -1

If the file you are checking is not in the same folder as the ACL project, you must specify either the relative path or absolute path to the file:

FILESIZE("C:\ACL Data\Sample Data Files\Metaphor_Inventory_2002.fil")

b. Recording the file size in the ACL command log

You can use the CALCULATE command to record the size of Metaphor_Inventory_2002.fil in the ACL command log:

CALCULATE FILESIZE("Metaphor_Inventory_2002.fil")



(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback