Renaming an Object Storage Object

Rename an object in an Object Storage bucket.

For information about object naming, see Object Names.

    1. Open the navigation menu and click Storage. Under Object Storage & Archive Storage, click Buckets.
    2. Select the compartment from the list under List Scope. All buckets in that compartment are listed in tabular form.
    3. Click the bucket whose object you want to rename. The bucket's Details page appears.
    4. Click Objects under Resources. The Objects list appears. All folders and objects are listed in tabular form.
    5. Click the Actions menu (Actions Menu) next to the object name, and select Rename. The Rename Object dialog box appears.
    6. Enter the new name for the object in the Object Name box. You can include an optional delimited directory structure prefix. For example, p_94.jpg or /marathon/participants/p_94.jpg. Avoid entering confidential information.
      Caution

      Buckets can't store two objects that use identical names (case-sensitive). If you rename an object using the name of another object in the same bucket, the object that originally used the name is overwritten.

    7. Click Save Changes.
  • Use the oci os object rename command and required parameters to rename an object in a bucket:

    oci os object rename --bucket-name bucket_name --name object_original_name --new-name object_new_name [OPTIONS]

    For example:

    oci os object rename --bucket-name MyBucket --name MyFile.txt --new-name MyRenamedFile.txt
    
    {
      "etag": "3504606b-8412-4b5d-924a-aeaeacf1df1e"
    }

    Renaming an Object having a Specific Entity Tag

    To make the rename operation dependent on the object having a specific entity tag, use the --src-obj-if-match-e-tag option.

    For example:

    oci os object rename --bucket-name MyBucket --name MyFile.txt --new-name MyRenamedFile.txt --src-obj-if-match-e-tag 6672BECB67CCFFBCE0530292F20ZBACE

    Overwriting an Object

    For rename operations where you intend to overwrite one object in a bucket with another, you can make the renaming dependent on having a specific entity tag. To do so, use the --new-obj-if-match-e-tag option.

    For example:

    oci os object rename --bucket-name MyBucket --name MyFile.txt --new-name MyRenamedFile.txt --new-obj-if-match-e-tag 6672BECB67CCFFBCE0530292F20ZBACE

    Preventing Overwriting an Object

    When renaming an object, you can prevent the system from overwriting another object in the same bucket by using the --new-obj-if-none-match-e-tag * option. This option prevents the renaming operation from completing if an object exists with the --new-name value specified and the same entity tag of the source object.

    For example:

    oci os object rename --bucket-name MyBucket --name MyFile.txt --new-name MyRenamedFile.txt --new-obj-if-none-match-e-tag *

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the RenameObject operation to rename an object in a bucket.

    Object Storage prepends the Object Storage namespace string and bucket name to the object name when constructing a URL for use with the API:

    /n/object_storage_namespace/b/bucket/o/object_name

    The object name is everything after the /o/, which could include hierarchy levels and prefix strings.