Skip to main content

TrFile_GetDataSize (function reference)

By June 1, 2024June 4th, 2024Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_GetDataSize
Troi File Plug-in for FileMaker Pro


Returns the size of the data for the file specified by the filePath. The size returns the actual number of bytes used in the file (not the size on disk).

SyntaxFunction badge

TrFile_GetDataSize ( switches ; filePath )


switches not used, reserved for future use. Leave blank or put "-Unused"
filePath the path to the file

Returned Result

Data type returned



The size (in bytes) of the data of the file specified. On macOS a file can have a data fork and also a resource fork. On macOS this function returns the size of the data fork only.

Originated in

Troi File Plug-in 1.0


FileMaker Pro 17 to FileMaker Pro 21 (2024)


See also the functions TrFile_GetFileSize and TrFile_GetResForkSize.

You can use FileMaker styled paths, like “filewin:/C:/MyFiles/test.txt”.


Assume there is a file “Read me” with the text “Hello!” in it. Then:

Set Field [ MyTextField ; TrFile_GetDataSize ( "-Unused" ; "Disk:Read me" ) ]

returns 6, which is the size of the data in the file. The total file size may be bigger.

Example 2

We assume that in your FileMaker file the following fields are defined:

    gFileSpec		Global, text
    gSize   		Global, number

gFileSpec should contain the path to an existing file, for example “D:\Readme.txt” (Windows) or “Mac HD:Readme.txt” (macOS). In a script add the following script step:

Set Field [ gSize ; TrFile_GetDataSize ( "-Unused" ; gFileSpec ) ]

This will fill gSize with the size of the data.

Used in example file


Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_GetDataSize (filep4224) 2024-0604 19:48:13