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

Files.CreateDirectory

Creates a directory.

Component: Files
Version: 2.7
Mac OS X: Yes
Windows: Yes
Server: Yes
FileMaker Cloud: Yes

MBS( "Files.CreateDirectory"; Path )

Parameters

Parameter Description Example value
Path Native path to the new directory to be created. "C:\Test"

Result

Returns "OK" or error message.

Description

Creates a directory.
Returns "OK" if the directory already exists.
This function needs a native path. Please use Path.FileMakerPathToNativePath function in order to convert a FileMaker style path to a native path.

In the Mac world we call it a folder, in the Windows world a directory. This function works cross platform and got the name with Directory years ago.

You can use Files.DeleteFolder to delete a folder with it's content.

Examples

Create folder on Desktop:

Set Variable [$folder; Value:MBS( "Folders.UserDesktop" )]
If [IsEmpty(Container Export::Name)]
    Set Field [Container Export::Name; "Record " & Get(RecordID)]
End If
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; $folder; Container Export::Name )]
Set Variable [$r; Value:MBS("Files.CreateDirectory"; $path)]

Creates directory and shows error:

Set Variable [$r; Value:MBS("Files.CreateDirectory"; $path)]
If [MBS("IsError")]
    Show Custom Dialog ["Failed to create directory"; MBS("Text.RemovePrefix"; $r; "[MBS] ")]
    Exit Script []
End If

Create a folder:

MBS( "Files.CreateDirectory"; "/Users/cs/Documents/FolderName" )

See also


Files.CreateBookmark   -   Files.CreateHardLink

Feedback: Report problem or ask question.




Links
MBS Real Studio Plugins - JUZ Nickenich