FILESIZE( ) function
Returns the size of the specified file in bytes or -1 if the file does not exist.
Syntax
FILESIZE(filename)
Parameters
Name | Type | Description |
---|---|---|
filename | character | The name of the file. If the file is in the same folder as the Analytics project, you do not need to specify the file path. For files in other folders, specify either a relative path or an absolute path. For example:
Note You need to specify the physical data file name (.fil) for Analytics tables, not the table name. |
Output
Numeric.
Examples
Basic examples
Returns 14744:
FILESIZE("Inventory.fil")
If the file you are checking is not in the same folder as the Analytics project, you must specify either the relative path or absolute path to the file.
Returns 6018:
FILESIZE("C:\ACL Data\Sample Data Files\Backup\Ap_Trans.fil")
Advanced examples
Executing a script if a file does not exist
Only executes the script import_data if the file Metaphor_Inventory_2002.fil does not exist:
DO SCRIPT import_data IF FILESIZE("Metaphor_Inventory_2002.fil") = -1
Recording a file's size in the Analytics command log
Use the CALCULATE command to record the size of Metaphor_Inventory_2002.fil in the Analytics command log:
CALCULATE FILESIZE("Metaphor_Inventory_2002.fil")