Create File
Create File is used to create an empty file at the specified path.
Properties
File Operation Settings
-
Create directory if it does not exist If this option is enabled, Create File creates either the specified relative directory or the whole specified path, if this does not already exist.
-
Directory path This is where you enter the path to the directory where the file is to be created. You can specify an absolute or relative path. If a relative path is used, then the path relates to the Base Path variable.
-
File Name Enter the name of the file that is to be created here.
-
Force error if file exists If this option has been enabled, an error message will interrupt the Workflow if a file with the same name already exists. If this option has not been enabled and the file already exists, it will be replaced with an empty file and no acknowledgment will be given.
-
Open with associated application If this option has been enabled, the newly created file will be opened with the application that is associated with the file name of the new file. For example, if the new file name ends in *.txt it will normally be opened with Notepad.
Leave this option disabled if you want another Action Step to be able to access the newly created file – otherwise it will be locked.
Other Properties that are the same in all Action Steps are described in the section on Common Properties. For reasons of clarity they are not shown here.
Inbound Variables
-
Directory path This is where you enter the path to the directory where the file is to be created. You can specify an absolute or relative path. If a relative path is used, then the path relates to the Base Path variable.
-
File Name* Enter the name of the file that is to be created here.
Outbound Variables
IsCreated The Create File.IsCreated variable indicates whether the file could be created or not (True/False).
File name The Create File.File Name variable provides the name of the file that has been created.
Directory path The Create File.Directory Path variable provides the path that is used.
Wizard
-
Directory path Specify the path here to the file that is being newly created. You can create an absolute path or a path relative to the Base Path. The initial value is %STWS_BASEPATH%. If you specify an absolute path and also enable the option Create Directory if it does not exist, the directory path will be created in full if it does not already exist. Select an existing path. You can also insert variables from the Workflow in order to construct the path. To do so, click on the pin and select one of the available variables.
-
File name Enter the name of the file here that is to be created. If you want the file to open with the associated program (option: Open created file with associated application), you must also specify a file extension. You can also insert a variable from the Workflow as the File Name. To do so, click on the pin and select one of the available variables.
-
Force error if file exists If this option has been enabled, an error message will interrupt the Workflow if a file with the same name already exists. If this option has not been enabled and the file already exists, it will be replaced with an empty file and no acknowledgment will be given.
-
Open with associated application If this option has been enabled, the newly created file will be opened with the application that is associated with the file name of the new file. For example, if the new file name ends in *.txt it will normally be opened with Notepad.
-
Create directory if it does not exist If this option is enabled, Create File creates either the specified relative directory or the whole specified path, if this does not already exist.
Example
Create an empty file using the Create File Action Step and write text to that file using the Write to Text File Action Step. The Write to Text File Action Step can be pointed directly to the newly created file using, for example, the Create File.Directory Path and Create File.FileName variables. This allows you to create your own log file containing text that is of interest to you.