Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mkdir

Creates a new directory with the specified permissions.

Creates a directory with the given name. The optional second argument specifies the permissions mode (default 0777), which is modified by the process umask before being applied. If no arguments are given, uses $_ as the directory name.

Returns 1 on success, 0 on failure. On failure, sets $! to the OS error code (e.g. EEXIST, EACCES).

Synopsis

mkdir("newdir", 0755) or die "Cannot mkdir: $!";
mkdir("newdir");         # default mode 0777 (modified by umask)
mkdir $_;                # uses $_ if no argument

See Also

rmdir, chmod, umask