Skip to main content

TrFile_GetFileSize (function reference)

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

TrFile_GetFileSize

Returns the file size for the file specified by the filePath. The size indicates the size the file is using on the disk, not the actual size of the data and resources.

SyntaxFunction badge

TrFile_GetFileSize ( switches ; filePath )

Parameters

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

Returned Result

Data type returned

Number

Result

The size (in number of bytes) of the file on disk.

Originated in

Troi File Plug-in 1.0

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Considerations

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

Example

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

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

returns 1024 (= 1 Kb) which is the size used on disk.

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” (Mac). In a script add the following scriptstep:

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

This will fill gSize with the total size of the file.

Used in example file

DataIn.fmp12

Related functionsFunction badge

TrFile_GetDataSize
TrFile_GetFolderSize
TrFile_GetResForkSize
TrFile_SelectFileDialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_GetFileSize (filep4241) 2024-0604 19:11:19