Filesystems/{filesystemName}/directory/{path}: DELETE
Removes a directory from a file system.
Availability
Available on all IBM Storage Scale editions.
Description
The DELETE filesystems/{filesystemName}/directory/{path} request removes a directory from a file system. You can use the safe parameter to define whether the directory is forcefully removed even if it is not empty. If you set the safe parameter to true then the rmdir command is issued to first check the state of the directory and proceed with deletion only if it is empty. If the directory is not empty then the rmdir command returns an error and fails to remove the directory.
Request URL
https://management API host:port/scalemgmt/v2/filesystems/filesystemName/directory/path
where:- filesystems/filesystemName
- Specifies the name of the file system to which the directory belongs. Required.
- directory/path
- The path of the directory to be removed.
Request headers
Accept: application/json
Request parameters
The following parameters can be used in the request URL to customize the
request:
Parameter name | Description and applicable keywords | Required/optional |
---|---|---|
filesystemName | The file system name. | Required. |
path | The directory path relative to the file system's mount point. | Required. |
safe | Specifies whether the directory is forcefully deleted. The default is false. | Optional. |
Request data
No request data.
Response data
{
"status": {
"code":ReturnCode",
"message":"ReturnMessage"
},
"jobs": [
{
"result":"",
{
"commands":"String",
"progress":"String,
"exitCode":"Exit code",
"stderr":"Error",
"stdout":"String",
},
"request":" ",
{
"type":"{GET | POST | PUT | DELETE}",
"url":"URL",
"data":""",
}
"jobId":"ID",
"submitted":"Time",
"completed":Time",
"status":"Job status",
}
],
}
For more information about the fields in the following data structures, see
the links at the end of this topic.- "jobs":
- An array of elements that describe jobs. Each element describes one job.
- "status":
- Return status.
- "message": "ReturnMessage",
- The return message.
- "code": ReturnCode
- The return code.
- "result"
-
- "commands":"String'
- Array of commands that are run in this job.
- "progress":"String'
- Progress information for the request.
- "exitCode":"Exit code"
- Exit code of command. Zero is success, nonzero denotes failure.
- "stderr":"Error"
- CLI messages from stderr.
- "stdout":"String"
- CLI messages from stdout.
- "request"
-
- "type":"{GET | POST | PUT | DELETE}"
- HTTP request type.
- "url":"URL"
- The URL through which the job is submitted.
- "data":" "
- Optional.
- "jobId":"ID",
- The unique ID of the job.
- "submitted":"Time"
- The time at which the job was submitted.
- "completed":Time"
- The time at which the job was completed.
- "status":"RUNNING | COMPLETED | FAILED"
- Status of the job.
Examples
The following example shows how to remove a directory from the file system fs1.
Request data:
curl -k -u admin:admin001 -X DELETE --header 'accept:application/json'
'https://198.51.100.1:443/scalemgmt/v2/filesystems/fs1/directory/mydir1?safe=false'
Response data:
Note: In the JSON data that is returned, the return code indicates whether the
command is successful. The response code 200 indicates that the command successfully retrieved the
information. Error code 400 represents an
invalid request and 500 represents internal server error.
{
"jobs": [
{
"jobId": 1000000000001,
"status": "COMPLETED",
"submitted": "2022-02-10 12:21:59,537",
"completed": "2022-02-10 12:21:59,830",
"runtime": 293,
"request": {
"type": "DELETE",
"url": "/scalemgmt/v2/filesystems/FS1/directory/mydir1"
},
"result": {
"progress": [],
"commands": [
"rmdir '/gpfs/FS1/mydir1' "
],
"stdout": [],
"stderr": [],
"exitCode": 0
},
"pids": []
}
],
"status": {
"code": 200,
"message": "The request finished successfully."
}
}