CL Command Reference - MKDIR

CL Command List > MKDIR Reference

Description:

The Create Directory (MKDIR) command adds a new directory to the system.

A directory is an object that contains the names of other objects. Libraries and folders are types of directories. When a directory is created, a link is added to the directory prefix. The directory must have been created before any objects can be placed into it.

This command is an alias for the Create Directory (CRTDIR) command and can also be issued using the following alternative command names:
. CRTDIR
. MD

Restrictions:

1. The following restriction applies when the directory to be created is a library in the QSYS.LIB or independent ASP QSYS.LIB file system, or a directory within the ¡åroot¡å (/), QOpenSys, or user-defined file systems:
. The audit (*AUDIT) special authority is required when specifying a value other than *SYSVAL on the Auditing value for objects (CRTOBJAUD) parameter.

2. The following restriction applies when the directory to be created is a folder in an existing folder in QDLS: v The change (*CHANGE) authority is required for the existing folder.

3. The user must have execute (*X) authority to each directory in the path.

4. When creating a directory in the ¡åroot¡å (/), QOpenSys or user_defined file system, the user must have write, execute (*WX) authority to the directory that contains the new directory.

5. When creating a directory, the owner ID (UID) is the user creating the directory. If the directory is to be created in the ¡åroot¡å (/), QOpenSys, and user-defined file systems, the following applies. If the S_ISGID bit of the parent directory is off, the group ID (GID) is set to the effective GID of the thread creating the directory. If the S_ISGID bit of the parent directory is on, the group ID (GID) of the new directory is set to the GID of the parent directory. If the directory is to be created in the QSYS.LIB or independent ASP QSYS.LIB file system, the GID is obtained from the primary user profile. For all other file systems, the GID is obtained from the parent directory.

6. The user must have all object (*ALLOBJ) and security administrator (*SECADM) special authorities to specify a value for the Scanning option for objects (CRTOBJSCAN) parameter other than *PARENT.


Examples:

The alternative command name for MKDIR is CRTDIR. The following examples use the alternative command name, but MKDIR can be replaced directly for CRTDIR in all of them.

Example 1: Creating a Directory

CRTDIR DIR(¡¯MYDIR¡¯)

This command creates the directory MYDIR and adds it to the current directory. The defaults are used for the remaining parameters.