FileDialog.SelectFolderDialog
-----------------------------

Shows dialog to select a folder.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FileDialog](component_FileDialog.md) | [2.7](newinversion27.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "FileDialog.SelectFolderDialog" ) ### Parameters

none

### Result

Returns "OK", "Cancel" or an error.

### Description

Shows dialog to select a folder.  
If dialog finishes well, you can query paths.  
  
Added support for multiple selection on Windows with plugin version for 6.4.  
### Examples

Run Select Folder Dialog:

 Delete All Records \[No dialog\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.Reset](FileDialogReset.md)")\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetShowHidden](FileDialogSetShowHidden.md)"; FileDialog::ShowHidden )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetAllowMulti](FileDialogSetAllowMulti.md)"; FileDialog::AllowMulti )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetResolvesAliases](FileDialogSetResolvesAliases.md)"; FileDialog::ResolvesAliases )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetTreatsFilePackagesAsDirectories](FileDialogSetTreatsFilePackagesAsDirectories.md)"; FileDialog::TreatsFilePackagesAsDirectories )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetCanSelectHiddenExtension](FileDialogSetCanSelectHiddenExtension.md)"; FileDialog::CanSelectHiddenExtension )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetWindowTitle](FileDialogSetWindowTitle.md)"; FileDialog::WindowTitle )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetInitialDirectory](FileDialogSetInitialDirectory.md)"; FileDialog::InitialDirectory )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetNameFieldLabel](FileDialogSetNameFieldLabel.md)"; FileDialog::NameFieldLabel )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetPrompt](FileDialogSetPrompt.md)"; FileDialog::Prompt )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetMessage](FileDialogSetMessage.md)"; FileDialog::Message )\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetNameFieldStringValue](FileDialogSetNameFieldStringValue.md)"; FileDialog::NameFieldStringValue )\]  
Set Variable \[$r ; Value:MBS ("FileDialog.SelectFolderDialog")\]  
If \[$r = "OK"\]  
 Set Variable \[$index ; Value:0\]  
 Set Variable \[$count ; Value:MBS ("[FileDialog.GetPathCount](FileDialogGetPathCount.md)")\]  
 Loop  
 New Record/Request  
 Set Field \[FileDialog::Path ; MBS ("[FileDialog.GetPath](FileDialogGetPath.md)"; $index )\]  
 Commit Records/Requests \[\]  
 Set Variable \[$index ; Value:$index + 1\]  
 Exit Loop If \[$index = $count \]  
 End Loop  
End If  
Export all containers to one folder:

 #Ask for folder?   
Set Variable \[$r ; Value:MBS ("[FileDialog.Reset](FileDialogReset.md)")\]  
Set Variable \[$r ; Value:MBS ("[FileDialog.SetMessage](FileDialogSetMessage.md)"; "Export folder?")\]  
Set Variable \[$r ; Value:MBS ("FileDialog.SelectFolderDialog")\]  
If \[$r = "OK"\]  
 #get path from dialog:  
 Set Variable \[$npath ; Value:MBS ( "[FileDialog.GetPath](FileDialogGetPath.md)"; 0 )\]  
 #convert to FileMaker path for Export Field Contents  
 Set Variable \[$fpath ; Value:MBS ( "[Path.NativePathToFileMakerPath](PathNativePathToFileMakerPath.md)"; $npath )\]  
 #Loop over all records:  
 Go to Record/Request/Page \[First\]  
 Loop  
 #Export files from this record  
 #figure out file name  
 Set Variable \[$name ; Value:GetAsText ( Container Batch Export::Test1 )\]  
 Set Variable \[$name ; Value:GetValue($name ; 1)\]  
 Set Variable \[$name ; Value:MBS ( "[Path.LastPathComponent](PathLastPathComponent.md)"; $name )\]  
 Set Variable \[$dpath ; Value:MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; $fpath ; $name )\]  
 Export Field Contents \[Container Batch Export::Test1 ; “$dpath ”\]  
 #Next record  
 Go to Record/Request/Page \[Next; Exit after last\]  
 End Loop  
End If  
Select folder in one expression:

 Let(\[  
  
r = MBS ("[FileDialog.Reset](FileDialogReset.md)");  
r = MBS ("FileDialog.SelectFolderDialog");  
folder = If ( r = "OK" ; MBS ("[FileDialog.GetPath](FileDialogGetPath.md)"; 0); "" )  
  
\]; folder)  
### See also

- [FileDialog.SelectItemDialog](FileDialogSelectItemDialog.md)
- [FileDialog.SetCanSelectHiddenExtension](FileDialogSetCanSelectHiddenExtension.md)
- [FileDialog.SetInitialDirectory](FileDialogSetInitialDirectory.md)
- [FileDialog.SetMessage](FileDialogSetMessage.md)
- [FileDialog.SetNameFieldLabel](FileDialogSetNameFieldLabel.md)
- [FileDialog.SetPrompt](FileDialogSetPrompt.md)
- [FileDialog.SetShowHidden](FileDialogSetShowHidden.md)
- [FileDialog.SetTreatsFilePackagesAsDirectories](FileDialogSetTreatsFilePackagesAsDirectories.md)
- [FileDialog.SetWindowTitle](FileDialogSetWindowTitle.md)
- [Path.NativePathToFileMakerPath](PathNativePathToFileMakerPath.md)

### Release notes

- **Version 10.3**
    - Added create folder button for [FileDialog.SelectFolderDialog](https://www.mbsplugins.eu/FileDialogSelectFolderDialog.shtml) function on MacOS.
- **Version 9.4**
    - Added check to [FileDialog.OpenFileDialog](http://www.mbsplugins.eu/FileDialogOpenFileDialog.shtml), [FileDialog.SaveFileDialog](http://www.mbsplugins.eu/FileDialogSaveFileDialog.shtml), [FileDialog.SelectFolderDialog](http://www.mbsplugins.eu/FileDialogSelectFolderDialog.shtml) and [FileDialog.SelectItemDialog](http://www.mbsplugins.eu/FileDialogSelectItemDialog.shtml) to ignore invalid initial directory for Mac.
- **Version 8.3**
    - Upgraded [FileDialog.OpenFileDialog](http://www.mbsplugins.eu/FileDialogOpenFileDialog.shtml), [FileDialog.SelectFolderDialog](http://www.mbsplugins.eu/FileDialogSelectFolderDialog.shtml) and [FileDialog.SaveFileDialog](http://www.mbsplugins.eu/FileDialogSaveFileDialog.shtml) to use newer API on Windows to get newer dialog.

### Example Databases

- [Containers/Container Batch Export](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Containers/Container%20Batch%20Export.shtml#1ScriptAnchor_)
- [DynaPDF/Batch Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Batch%20Preview.shtml#1ScriptAnchor_)
- [Files/FileDialog](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Files/FileDialog.shtml#4ScriptAnchor_)
- [Mac and iOS/PDFKit/Pictures to PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Pictures%20to%20PDF.shtml#3ScriptAnchor_)
- [SQL in FileMaker/ImageGallery](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20in%20FileMaker/ImageGallery.shtml#1ScriptAnchor_)

### Blog Entries

- [Tips and tricks with MBS](https://www.mbsplugins.de/archive/2023-08-10/Tips_and_tricks_with_MBS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr10](https://www.mbsplugins.de/archive/2020-07-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.4pr7](https://www.mbsplugins.de/archive/2019-09-12/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.3pr1](https://www.mbsplugins.de/archive/2018-06-04/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [Comparing Base Elements Plugin to MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2017-10-24/Comparing_Base_Elements_Plugin/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.4pr9](https://www.mbsplugins.de/archive/2016-09-24/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.3pr3](https://www.mbsplugins.de/archive/2014-07-22/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 3/2012, Seite 31](https://filemaker-magazin.de/neuigkeit/3561-Appetithappen-FMM_201203)

This function checks for a license.

Created 18th August 2014 , last changed 21st June 2017

  
[FileDialog.SaveFileDialog](FileDialogSaveFileDialog.md) - [FileDialog.SelectItemDialog](FileDialogSelectItemDialog.md)

[HTML Version](FileDialogSelectFolderDialog.shtml)