Skip to main content

TrFile_GetFolderSize (function reference)

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

TrFile_GetFolderSize

Returns the size for the folder specified by the folderPath. The size is the total size of all the files in the folder and subfolders.

SyntaxFunction badge

TrFile_GetFolderSize ( switches ; folderPath )

Parameters

switches this modifies the behavior of the function
folderPath the path to the folder for which you want the information

Switches

Switches can be empty or one or the following:

-SkipInvisibles don’t add the size of invisible (hidden) files to the returned size

Returned Result

Data type returned

Number

Result

The size (in number of bytes) of the folder.

Originated in

Troi File Plug-in 9.0

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Considerations

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

v15.0 adds the -SkipInvisibles switch: if you add this switch the plug-in will not add the size of invisible (hidden) files to the returned size. Invisible files are files with hidden attribute or files with a filename that starts with a period. See also the ListFolder.fmp12 example file.

Example

Assume there is a folder “MyData” with several files in it. Then add this to a script:

Set Variable [ $FolderSize; TrFile_GetFolderSize ("-Unused" ; "Mydisk:MyData" ) ] 

This might return 1048576 (= 1 Mb) which is the total of the file sizes of the files in the folder.

Example 2

Set Variable [ $FolderPath; "Mydisk:MyData" ) ] 
Set Variable [ $FolderSize; TrFile_GetFolderSize ("-SkipInvisibles" ; $FolderPath ) ] 

This might return 1040003 which is the total of the file sizes of the files in the folder, without the invisible files.

Used in example file

ListFolder.fmp12

Related functionsFunction badge

TrFile_GetDataSize
TrFile_GetFileSize
TrFile_ListFolder

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_GetFolderSize (filep4315) 2024-0604 19:13:09