Create the specified directory in the working directory.

dircreate  NewDirPath

Example: dircreate "exports"


Parameter Data Type Description
NewDirPath String Directory name, optionally preceded by the path to the directory, which can be in a zip archive. Must end with a directory separator.

Return Values

Values returned by $procerror
Value  Error constant Meaning


-13 <UIOSERR_OS_COMMAND> An error occurred while trying to perform the OS command. Set /pri=64 to display the exact error in the message frame.


Allowed in all component types.


The dircreate statement creates the specified directory in the current working directory using any file redirections in the assignment file.

Specifying the Directory

  • Each specification can be a string, a field (or indirect reference to a field), a variable, or a function that evaluates to a string.
  • The total length of any path (or file name or directory name) must not exceed 255 bytes.
  • Valid generic directory separators are the backward slash (\), the forward slash (/) , and the period (.) in combination with square brackets ([a.b]). These are translated to the platform-specific separators.
  • No wildcards are allowed in any path, except for $ldirlist and $dirlist, which allows the Uniface wildcards ? (GOLD ?) and * (GOLD *) in the directory name, for example ab?, or in its suffix, for example abc\*.txt.

For more information, see Syntax of File and Directory Names.

Operation Failure

The operation fails if NewDirPath:

  • Already exists
  • Does not permit user-creation due to insufficient authorization level
  • Has invalid syntax
  • Specifies the $RES path, for example "$RES:\NewDirPath"

Creating a Directory in the Current Working Directory

The following ProcScript creates a directory with the name coffee in the current working directory:

dircreate "coffee"

Creating a Directory in an Existing Directory

The following ProcScript creates a directory with the name coffee in the directory sub1dir in the current directory:

dircreate "sub1dir\coffee\"


dircreate "[.sub1dir.coffee.]"


On Unix, the directory is created with read and write access on world, group, and user level.


On iSeries, dircreate creates a library or a file in a library or, when the IFS prefix is used, a directory in the IFS.

If used without the IFS prefix, a library, or a file in a library, is created. Libraries cannot have sublibraries, so no more than one directory separator is allowed. That is, the only allowed syntax is library/ or file or library/file.

If used with the IFS prefix, an IFS directory is created. Directories in the IFS can have subdirectories, but the different file systems existing in the IFS have their own rules and limitations.

For more information, see File-Naming Considerations on iSeries.


Related Topics