Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Files.FolderSize

Calculate sizes of folder.

Component Version macOS Windows Linux Server iOS SDK
Files 6.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Files.FolderSize"; Path { ; RecursionLimit; IgnoreHiddenFolderContent; CountBundlesAsItem } )   More

Parameters

Parameter Description Example Flags
Path Native file path to folder. "C:\Test"
RecursionLimit The limit for the recursion.
Default is -1 for no limit.
Pass zero to only look in files in that folder and not subfolders.
0 Optional
IgnoreHiddenFolderContent Do not count items in hidden subfolders.
Pass 1 to ignore or 0 to count. Default is 0.
0 Optional
CountBundlesAsItem Count bundles as items.
Default is 0 to look inside those bundles, e.g. apps.
Pass 1 to count bundles as files.
1 Optional

Result

Returns values or error.

Description

Calculate sizes of folder.
On success returns a list of values. Please calculate ones, save result in variable and pick the values you need. It's quite efficient for us to query all those values in one run as disk access is the slowest part here, not summing up the values.

NamePositionDescriptionExample
ItemCount1Total number of items153
FilesCount2Total number of files140
FolderCount3Total number of folders.13
VisibleItemCount4Number of visible items.143
HiddenItemCount5Number of hidden items.10
VisibleFilesCount6Number of visible files.130
HiddenFilesCount7Number of hidden files.10
VisibleFolderCount8Number of visible folders.13
HiddenFolderCount9Number of hidden folders.0
PhysicalTotalSize10Total physical byte size.186777600
LogicalTotalSize11Total logical byte size.186581344
VisiblePhysicalTotalSize12Total physical byte size for visible files.186679296
VisibleLogicalTotalSize13Total logical byte size for visible files.186507445
HiddenPhysicalTotalSize14Total physical byte size for hidden files.98304
HiddenLogicalTotalSize15Total logical byte size for hidden files.73899
PhysicalDataForkSize16Total physical byte size.172150784
LogicalDataForkSize17Total logical byte size.171970091
VisiblePhysicalDataForkSize18Total physical data fork byte size for visible files.172052480
VisibleLogicalDataForkSize19Total logical data fork byte size for visible files.171896192
HiddenPhysicalDataForkSize20Total physical data fork byte size for hidden files.98304
HiddenLogicalDataForkSize21Total logical data fork byte size for hidden files.73899
PhysicalResourceForkSize22Total physical resource fork byte size.14626816
LogicalResourceForkSize23Total logical resource fork byte size.14611253
VisiblePhysicalResourceForkSize24Total physical resource fork byte size for visible files.14626816
VisibleLogicalResourceForkSize25Total logical resource fork byte size for visible files.14611253
HiddenPhysicalResourceForkSize26Total physical resource fork byte size for hidden files.0
HiddenLogicalResourceForkSize27Total logical resource fork byte size for hidden files.0
RecursionMaxLevel28Maximum recursion level we had.3

Windows doesn't know about resource fork, so the resource fork sizes are zero there always.
Currently block size calculation for Windows is not done, so logical and physical sizes are identical.

Implemented in version 10.4 for iOS and Linux.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Calculate my desktop size:

MBS( "Files.FolderSize"; "/Users/cs/Desktop" )

Caluclate on Windows:

MBS( "Files.FolderSize"; "/Users/cs/Desktop" )

See also

Release notes

Blog Entries

This function checks for a license.

Created 11st March 2016, last changed 11st August 2020


Files.FileUTITypes - Files.GetComment