Updated on 2024-04-17 GMT+08:00

Creating a Folder

Function

You can use this command to create a folder in a specified bucket or local file system.

No error is returned if a folder with the same name as an existing one is created, and the content of the existing folder remains unchanged.

Command Line Structure

  • In Windows
    • Creating a folder in a specified bucket
      obsutil mkdir obs://bucket/folder[/subfolder1/subfolder2] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
    • Creating a folder in the local file system
      obsutil mkdir folder_url [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • In Linux or macOS
    • Creating a folder in a specified bucket
      ./obsutil mkdir obs://bucket/folder[/subfolder1/subfolder2] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
    • Creating a folder in the local file system
      ./obsutil mkdir folder_url [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]

Examples

  • Take the Windows OS as an example. Run the obsutil mkdir obs://bucket-test/folder1/folder2 command to create a folder in a bucket.
    obsutil mkdir obs://bucket-test/folder1/folder2
    
    Create folder [obs://bucket-test/folder1/] successfully, request id [0000016979E1D23C860BB3D8E4577C5E]
    Create folder [obs://bucket-test/folder1/folder2] successfully, request id [0000016979E1D2B2860BB5181229C72C]

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory when creating a folder in a specified bucket

Bucket name

folder

Mandatory when creating a folder in a specified bucket

Folder path in the bucket. This value can contain multi-level folders. Separate each level with a slash (/).

folder_url

Mandatory when creating a folder in the local file system

Folder path in the local file system. The value can be an absolute path or a relative path.

config

Optional (additional parameter)

User-defined configuration file for executing a command. For details about parameters that can be configured, see Parameter Description.

e

Optional (additional parameter)

Specifies the endpoint.

i

Optional (additional parameter)

Specifies the user's AK.

k

Optional (additional parameter)

Specifies the user's SK.

t

Optional (additional parameter)

Specifies the user's security token.