Path: API › 文件管理

`POST /files`

获取指定路径的磁盘占用大小。

## Request body

_Required._

- `action140.request_time` (string, required) — Unix 时间戳。
- `action140.request_token` (string, required) — 按 API 概览生成的签名。
- `action140.action` (string, required) — 具体操作名称。
  - one of `"get_path_size"`
- `action140.path` (string, required) — 目标路径

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "get_path_size",
  "path": "string"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/files" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=get_path_size" \
  --data-urlencode "path=<path>"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "path": "/www/wwwroot",
  "size": 245760
}
```

- `action140.response.default.path` (string, optional) — 传入的路径
- `action140.response.default.size` (integer, optional) — 路径占用磁盘大小（字节）


## get_path_size

获取指定路径的磁盘占用大小。

- **路由**：`POST /files`
- **action**：`get_path_size`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `get_path_size` |
| path | 是 | String | 目标路径 |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| path | String | 传入的路径 |
| size | Integer | 路径占用磁盘大小（字节） |

## 示例

### 请求

```
POST /files HTTP/1.1
Host: 192.168.168.213:8888
Content-Type: application/x-www-form-urlencoded

action=get_path_size&path=/www/wwwroot
```

### 响应

```json
{"path": "/www/wwwroot", "size": 245760}
```

