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.
TrFile_GetFileSize ( switches ; filePath )
|switches||not used, reserved for future use. Leave blank or put "-Unused"|
|filePath||the path to the file for which you want the information|
Data type returned
The size (in number of bytes) of the file on disk.
Troi File Plug-in 1.0
FileMaker Pro 16 to 19
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_GetFileSize ( "-Unused" ; "Disk:Read me" ) ]
returns 1024 (= 1 Kb) which is the size used on disk.
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
Troi File Plug-in online help (overview)