Skip to main content
Hitachi Vantara Knowledge

Rename a file system directory

Renames a file system directory.

HTTP request syntax (URI)
PATCH <base_URI>/v8/storage/filesystems/{filesystemId}/directories/{directoryObjectId}
Name Type Required Values Description
filesystemId URI_PARAM Y string Either the file system object ID or HNAS file system ID.
directoryObjectId URI_PARAM Y string Directory object ID.
newDirectory BODY Y string New absolute path of the directory. The path should be in UNIX format. If this directory exists or is not empty, the operation will fail.
ensureExist BODY Y boolean When set to TRUE, the end result is similar to the mkdir -p, which allows a directory to be created even though its parent directory does not exist. In this case, if the /destination object does not exist, and the newDirectory variable has the values /destination/subdirectory and ensureExist is TRUE, the operation will succeed.
Return codes
Code Data Description
303 directory File system directory has been successfully renamed.
400 Error Message Missing or invalid request contents.
403Error MessageOperation forbidden by access level.
404 Error Message Requested resource not found.
500 Error message Error associated with the storage system.

Any HTTP status code other than 303 indicates that the operation did not complete successfully.

Request example 1: Rename a directory using the file system object ID
curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" -X PATCH -d '{"newDirectory": "/xyz_rename","ensureExist":true}'
Request example 2: Rename a direcrtory using the HNAS storage file system ID
curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" -X PATCH -d '{"newDirectory":"/xyz_rename","ensureExist":true}'
Response example: Both requests produce the same response
HTTP/1.1 303 See Other
   "directory" : {
      "displayName" : [ "//xyz_rename" ],
      "name" : "xyz_rename",
      "objectId" : "6d6574726f5f72656e616d65"
   "uri" :  


  • Was this article helpful?