Create Directory
Creates a directory according to the given path and file system.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
createDir --path(String) [--fileSystem(FileSystem)] (String)=value
Input parameter
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Path | path |
Required |
Text |
Path where the new directory will be created. |
File system | fileSystem |
Optional |
File System |
Connection with a file system. For more information about the supported file systems and how to connect to them, see Integration with external apps. If this parameter is blank, the command uses the operating system file system. |
Output parameter
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Directory | value |
Text |
Returns the full path to the new directory. |
Example
Example 1: Create the ExampleFolder
directory in the path defined on the Get System Folder Path (getSpecialFolder
) command, using the local file
system.
defVar --name obtainedDirectory --type String
defVar --name createdDirectory --type String
// Get the Desktop folder.
getSpecialFolder --folder "Desktop" obtainedDirectory=value
// Create the directory.
createDir --path "${obtainedDirectory}\\ExampleFolder" createdDirectory=value
logMessage --message "${createdDirectory}" --type "Info"
Example 2: Create a new directory in a Dropbox account.
Before you run this example, you must create a connection to Dropbox named "Dropbox connection". For more information about how to create connections, see Adding connections to an application.
defVar --name dropboxConncetion --type FileSystem
defVar --name newDirectory --type String
// Connects to a Dropbox account to create a new directory there
dropboxConnect --name dropbox_connection_dropbox dropboxConncetion=value
// Create a new directory on the "newDirectory" folder in Dropbox
createDir --path "/newDirectory" --fileSystem ${dropboxConncetion} newDirectory=value
logMessage --message "${newDirectory}" --type "Info"