Renaming an Object
If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference
You can use ObsClient.renameObject to rename files or directories in a parallel file system. The sample code is as follows:
String endPoint = "https://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
// Rename an object.
RenameObjectRequest request = new RenameObjectRequest();
request.setBucketName("bucketname");
// objectKey indicates the old object name.
request.setObjectKey("folderName/originalObjectName");
// newObjectKey indicates the new object name.
request.setNewObjectKey("newFolderName/newObjectName");
RenameObjectResult result = obsClient.renameObject(request);
- This API is supported only in the parallel file system.
Last Article: Modifying an Object
Next Article: Truncating an Object
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.