Rename a file system directory

NAS File Storage REST API v7 Reference

Version
14.7.x
14.6.x
Audience
anonymous
Part Number
MK-92HNAS088-05

Renames a file system directory.

HTTP request syntax (URI)

PATCH <base_URI>/v7/storage/filesystems/{id}/directories/{directoryObjectId}

Parameters

Name Type Required Values Description
id URI_PARAM Y string Specifies either the object ID of the file system or the 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 No Data Missing or invalid request contents.
404 Error Message Requested resource not found.
500 Error message Error associated with the storage system.
501 No Data Server has not implemented the request operation on the resource.

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

Request example: Using the file system object ID

curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" https://172.17.11.11:8444/v7/storage/filesystems/3037303741394333364638443842374230303030303030303030303030303030/directories/6d6574726f5f64697232 -X PATCH -d '{"newDirectory": "/xyz_rename","ensureExist":true}'

Response example: Using the file system object ID

HTTP/1.1 303 See Other
{
   "directory" : {
      "displayName" : [ "//xyz_rename" ],
      "objectId" : "6d6574726f5f72656e616d65"
   },
   "uri" : 			 		
"https://172.17.11.11:8444/v7/storage/filesystems/3037303741394333364638443842374230303030303030303030303030303030/directories/6d6574726f5f72656e616d65"
}

Request example: Using the HNAS storage file system ID

curl -vk -H "X-Api-Key: zrxvSDAv9x.RIP4gkmKarG3beF.or.4Tc2im7oeqYN88C9XPGHxbXC" https://172.17.11.11:8444/v7/storage/filesystems/864DC6E1DFB68C210000000000000000/directories/6d6574726f5f64697232 -X PATCH -d '{"newDirectory":"/xyz_rename","ensureExist":true}'

Response example: Using the HNAS storage file system ID

HTTP/1.1 303 See Other
{
   "directory" : {
      "displayName" : [ "//xyz_rename" ],
      "objectId" : "6d6574726f5f72656e616d65"
   },
   "uri" :  
"https://172.17.11.11:8444/v7/storage/filesystems/3037303741394333364638443842374230303030303030303030303030303030/directories/6d6574726f5f72656e616d65"
}