mkdir

Make Directory (Create folders)

Multiple folders will be created in the order specified, using mode rwx rwx rwx (0777) as modified by the current umask.

Syntax
          mkdir [-pv] [-m mode] folder...

Options

     -m mode
       Set the file permission bits of the final created directory to
       the specified mode.  The mode can be in any of the formats
       specified to the chmod command.  If a symbolic mode is
       specified, the operation characters '+' and '-' are interpreted
       relative to an initial mode of `a=rwx'.

     -p       Create intermediate folders as required.  If this option is
       not specified, the full path prefix of each operand must already
       exist.  On the other hand, with this option specified, no error
       will be reported if a directory given as an operand already
       exists.

     -v       Verbose = list folders as they are created.     

The -v option is non-standard and its use in scripts is not recommended.

The user must have write permission in the parent directory.

If an error occurs, mkdir exits with a value >0.

Examples

  mkdir MyFolder MyFolder/SubFolder "My Other Folder"

“The salary of the chief executive of the large corporation is not a market award for achievement. It is frequently in the nature of a warm personal gesture by the individual to himself” ~ J K Galbraith

Related macOS commands

mkfile - Create a file.
rm - Remove files or folders (including recursive delete).
cp - Copy files.
ls - List information about files.


 
Copyright © 1999-2024 SS64.com
Some rights reserved