Skip to main content

Create Folder (script step reference)

Troi File Plug-in for FileMaker Pro

Create Folder

Creates a new (empty) folder (subdirectory).

SyntaxScript step badge

Create Folder [ Select ; Result (error) ; FolderPath ]

Options

Select entire contents replaces the contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error) an error code
folderPath the path to the folder to create

Returned Result

Data type returned

Error code

Result

The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0 no error The folder was created
$$-48 dupFNErr Destination folder already exists
$$-1 genericErr The folder could not be created
$$-50 paramErr Parameter error

Other errors may be returned.

Originated in

Troi File Plug-in 9.0

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

You can use FileMaker styled paths, like “filemac:/MacHD/folder/subfolder”.
See also the script steps Show Select Folder Dialog to get a folderPath for a folder, and Create File to create a new empty file.

You can specify a path and the plug-in will create the folder, including all folders in the path that do not exist.

Example

We assume that a global number field gErrorCode is defined. Create the following script:

Create Folder [ Select ; gErrorCode ; "C:\Data\NewFolder" ]

This script will create the folder “NewFolder” inside the Data folder on the C disk.
On macOS this will be:

Create Folder [ Select ; gErrorCode ;  "MyDisk:Data:NewFolder" ]

Example 2

We assume that in your FileMaker file the following fields are defined:

  gErrorCode		Global, number
  gFolderPath		Global, text

gFolderPath should contain the path to the folder to be created and should not exist, for example “D:\Logs\Data” (Windows) or “Mac HD:Logs:Data” (macOS ). In a script add the following scriptstep:

Create Folder [ Select ; $ErrorCode ; gFolderPath  ]

This will create the folder specified in the gFolderPath and store the error code in the variable $ErrorCode.

Related script stepsScript step badge

Create File
Delete Folder
Show Select File Dialog
Show Select Folder Dialog

Related functionFunction badge

TrFile_CreateFolder

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 16 to 2023 –> Create Folder (filep7212) 2023-0601 16:20:04