To organize objects in a bucket, you can use directories. This topic describes how to use the mkdir command to create a directory in Object Storage Service (OSS).
Usage notes
To create a directory, you must have the
oss:GetObject
andoss:PutObject
permissions. For more information, see Attach a custom policy to a RAM user.
Command syntax
ossutil mkdir oss://bucket/dir_name [flags]
Option | Type | Description |
bucket | string | The name of the bucket. |
dir_name | string | The directory name. |
--encoding-type | string | The encoding of the input object name or file name. Valid value: url. If you do not specify this option, the directory name is not encoded. |
--request-payer | string | The payer of the traffic and request fees. If pay-by-requester is enabled, specify this parameter. Valid value: requester. |
For more information, see Command-line options.
Examples
Create a single-level directory.
ossutil mkdir oss://examplebucket/dir
Create a multi-level directory.
ossutil mkdir oss://examplebucket/dir1/dir2