The mkdir command is used to create a directory in a bucket.

Note The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.

Command syntax

./ossutil mkdir oss://bucket/dir/

Examples

  • Create a directory
    ./ossutil mkdir oss://bucket1/dir1/
    Note
    • A directory must end with a forward slash (/). If the specified directory name does not end with a forward slash, ossutil will automatically add one forward slash (/).
    • If the specified directory already exists, an error is displayed.
  • Create a multi-level directory
    ./ossutil mkdir oss://bucket/dir1/dir2/

    When you use ossutil to create a multi-level Directory, only the last level of directory is created. If dir2/ is deleted and there are no objects in dir1/, dir1/ will also be deleted after the command is run.

Common options

The following table describes the options you can add to the mkdir command.
Option Description
--encoding-type Specifies the method used to encode the object name. If this option is specified, this value must be url. If this option is not specified, the object name is not encoded. Bucket names cannot be URL-encoded.
--loglevel Specifies the log level. The default value is null, indicating that no log files are generated. Valid values:
  • info: generates prompt logs.
  • debug: generates detailed logs that contain corresponding HTTP request and response information.
--proxy-host Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. An example of the URL is http://120.79. **.**:3128 or socks5://120.79. **. **:1080.
--proxy-user Specifies the username for the proxy server. The default value is null.
--proxy-pwd Specifies the password for the proxy server. The default value is null.
Note For more information about common options, see View all supported options.