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.
Syntax
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 functions
TrFile_GetDataSize |
TrFile_GetFolderSize |
TrFile_GetResForkSize |
TrFile_SelectFileDialog |
Related topics
Troi File Plug-in online help (overview)