Path: API › 文件管理

`POST /files`

检测指定路径是否存在，返回路径、类型（目录/文件）和存在状态。

## Request body

_Required._

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

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "test_path",
  "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=test_path" \
  --data-urlencode "path=<path>"
```

## Responses

### default

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

#### Example

```json
{
  "path": "/www/wwwroot",
  "is_dir": true,
  "exists": true
}
```

- `action147.response.default.path` (string, optional) — 路径
- `action147.response.default.is_dir` (boolean, optional) — `true` 为目录，`false` 为文件，`null` 为不存在
- `action147.response.default.exists` (boolean, optional) — 路径是否存在


## test_path

检测指定路径是否存在，返回路径、类型（目录/文件）和存在状态。

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

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `test_path` |
| path | 是 | String | 要检测的路径 |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| path | String | 路径 |
| is_dir | Boolean | `true` 为目录，`false` 为文件，`null` 为不存在 |
| exists | Boolean | 路径是否存在 |

## 示例

### 请求

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

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

### 响应

```json
{"path": "/www/wwwroot", "is_dir": true, "exists": true}
```

