Files.FolderSize
----------------

Calculate sizes of folder.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Files](component_Files.md) | [6.2](newinversion62.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

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

**MBS**( **"Files.FolderSize";** /\* Calculate sizes of folder. \*/  
**$Path**; /\* Native file path to folder.e.g. "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.e.g. 0 \*/   
**$IgnoreHiddenFolderContent**; /\* Optional; Do not count items in hidden subfolders.  
Pass 1 to ignore or 0 to count. Default is 0.e.g. 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.e.g. 1 \*/ 

### 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.  
  
| Name | Position | Description | Example |
|---|---|---|---|
| ItemCount | 1 | Total number of items | 153 |
| FilesCount | 2 | Total number of files | 140 |
| FolderCount | 3 | Total number of folders. | 13 |
| VisibleItemCount | 4 | Number of visible items. | 143 |
| HiddenItemCount | 5 | Number of hidden items. | 10 |
| VisibleFilesCount | 6 | Number of visible files. | 130 |
| HiddenFilesCount | 7 | Number of hidden files. | 10 |
| VisibleFolderCount | 8 | Number of visible folders. | 13 |
| HiddenFolderCount | 9 | Number of hidden folders. | 0 |
| PhysicalTotalSize | 10 | Total physical byte size. | 186777600 |
| LogicalTotalSize | 11 | Total logical byte size. | 186581344 |
| VisiblePhysicalTotalSize | 12 | Total physical byte size for visible files. | 186679296 |
| VisibleLogicalTotalSize | 13 | Total logical byte size for visible files. | 186507445 |
| HiddenPhysicalTotalSize | 14 | Total physical byte size for hidden files. | 98304 |
| HiddenLogicalTotalSize | 15 | Total logical byte size for hidden files. | 73899 |
| PhysicalDataForkSize | 16 | Total physical byte size. | 172150784 |
| LogicalDataForkSize | 17 | Total logical byte size. | 171970091 |
| VisiblePhysicalDataForkSize | 18 | Total physical data fork byte size for visible files. | 172052480 |
| VisibleLogicalDataForkSize | 19 | Total logical data fork byte size for visible files. | 171896192 |
| HiddenPhysicalDataForkSize | 20 | Total physical data fork byte size for hidden files. | 98304 |
| HiddenLogicalDataForkSize | 21 | Total logical data fork byte size for hidden files. | 73899 |
| PhysicalResourceForkSize | 22 | Total physical resource fork byte size. | 14626816 |
| LogicalResourceForkSize | 23 | Total logical resource fork byte size. | 14611253 |
| VisiblePhysicalResourceForkSize | 24 | Total physical resource fork byte size for visible files. | 14626816 |
| VisibleLogicalResourceForkSize | 25 | Total logical resource fork byte size for visible files. | 14611253 |
| HiddenPhysicalResourceForkSize | 26 | Total physical resource fork byte size for hidden files. | 0 |
| HiddenLogicalResourceForkSize | 27 | Total logical resource fork byte size for hidden files. | 0 |
| RecursionMaxLevel | 28 | Maximum 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](PathFileMakerPathToNativePath.md) 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](component_FileDialog.md) 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

- [Files.FileSize](FilesFileSize.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 10.4**
    - Implemented [Files.FolderSize](https://www.mbsplugins.eu/FilesFolderSize.shtml) for iOS and Linux.

### Blog Entries

- [MBS FileMaker Plugin, version 10.4pr4](https://www.mbsplugins.de/archive/2020-08-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.2pr1](https://www.mbsplugins.de/archive/2016-03-19/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [New functions for MBS FileMaker Plugin coming soon](https://www.mbsplugins.de/archive/2016-03-17/New_functions_for_MBS_FileMake/monkeybreadsoftware_blog_filemaker)
- [Calculating folder size](https://www.mbsplugins.de/archive/2016-03-11/Calculating_folder_size/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2020, Seite 34](https://filemaker-magazin.de/neuigkeit/4103-Appetithappen-FMM_202004)
- [Ausgabe 2/2017, Seite 38](https://filemaker-magazin.de/neuigkeit/3930-Appetithappen-FMM_201702)

This function checks for a license.

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

  
[Files.FileUTITypes](FilesFileUTITypes.md) - [Files.GetComment](FilesGetComment.md)

[HTML Version](FilesFolderSize.shtml)