## XSIUtils.EnsureFolderExists

### Introduced

v5.0

### Description

Makes sure that all directories have been created in the specified path. For example if the proposed file path is c:\temp\a\b\c\out.txt and a, b, and c do not exist yet then this method ensures that they are created. This is more powerful than the (Windows Scripting Host) FileSystemObject.CreateFolder method which only succeeds if all folders except for the very last in the path already exists.
Note: If the path is invalid or the user does not have sufficient permissions to create the directory this method will fail.
Tip: If the full path to the file already exists then this method will do nothing.

### C# Syntax

    XSIUtils.EnsureFolderExists( String in_Path, Boolean in_bHasFileName );

### Scripting Syntax

    XSIUtils.EnsureFolderExists( Path, HasFilename );

### Parameters

Parameter | Type | Description
--- | --- | ---
Path | String | The full path, which can be either a network or local path.
HasFilename | Boolean | Whether the Path argument includes a file name at the end. For example, if Path is "C:\temp\a\b.txt" and HasFileName is false then this method will create a directory called "b.txt". Default Value: false

### See Also

XSIUtils.ResolvePath XSIUtils.BuildPath