Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  


Calculate sizes of folder.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Files 6.2 Yes Yes Yes Yes Yes

MBS( "Files.FolderSize"; Path { ; RecursionLimit; IgnoreHiddenFolderContent; CountBundlesAsItem } )


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


Returns values or error.


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.

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.

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.


Calculate my desktop size:

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

Caluclate on Windows:

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

See also

Files.FileUTITypes   -   Files.GetComment

Feedback: Report problem or ask question.

MBS Xojo Chart Plugins