Path: API › 文件管理

`POST /files`

浏览服务器文件系统，查看指定目录下的文件和子目录列表，支持分页和搜索。

## Request body

_Required._

- `action124.request_time` (string, required) — Unix 时间戳。
- `action124.request_token` (string, required) — 按 API 概览生成的签名。
- `action124.action` (string, required) — 具体操作名称。
  - one of `"GetDirNew"`
- `action124.path` (string, optional) — 目录路径，默认 `/www/wwwroot`
- `action124.search` (string, optional) — 搜索关键词，匹配文件名
- `action124.all` (string, optional) — 传任意值触发全量搜索模式
- `action124.p` (integer, optional) — 页码，默认 `1`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "GetDirNew",
  "path": "string",
  "search": "string",
  "all": "string",
  "p": 0
}
```

## 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=GetDirNew"
```

## Responses

### default

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

#### Example

```json
{
  "store": [],
  "file_recycle": false,
  "page": "<div><span class='Pcurrent'>1</span><span class='Pnumber'>1/1</span><span class='Pline'>从1-3条</span><span class='Pcount'>共3条</span></div>",
  "path": "/www/wwwroot",
  "dir": [
    {
      "nm": "api-demo.bt.local",
      "sz": 4096,
      "mt": 1779451143,
      "acc": "755",
      "user": "www",
      "lnk": "",
      "durl": "",
      "cmp": 0,
      "fav": "0",
      "rmk": "",
      "top": 0,
      "sn": "api-demo.bt.local"
    },
    {
      "nm": "default",
      "sz": 4096,
      "mt": 1779433215,
      "acc": "755",
      "user": "root",
      "lnk": "",
      "durl": "",
      "cmp": 0,
      "fav": "0",
      "rmk": "",
      "top": 0,
      "sn": "default"
    }
  ]
}
```

- `action124.response.default.path` (string, optional) — 当前路径
- `action124.response.default.dir` (string, optional) — 子目录列表，每项含 `nm`(名称)、`sz`(大小)、`mt`(修改时间戳)、`acc`(权限)、`user`(属主)
- `action124.response.default.page` (string, optional) — 分页 HTML 片段
- `action124.response.default.store` (array<unknown>, optional) — 收藏夹目录列表
- `action124.response.default.file_recycle` (boolean, optional) — 回收站状态


## GetDirNew

浏览服务器文件系统，查看指定目录下的文件和子目录列表，支持分页和搜索。

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

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `GetDirNew` |
| path | 否 | String | 目录路径，默认 `/www/wwwroot` |
| search | 否 | String | 搜索关键词，匹配文件名 |
| all | 否 | String | 传任意值触发全量搜索模式 |
| p | 否 | Integer | 页码，默认 `1` |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| path | String | 当前路径 |
| dir | Array&lt;Object&gt; | 子目录列表，每项含 `nm`(名称)、`sz`(大小)、`mt`(修改时间戳)、`acc`(权限)、`user`(属主) |
| page | String | 分页 HTML 片段 |
| store | Array | 收藏夹目录列表 |
| file_recycle | Boolean | 回收站状态 |

## 示例

### 请求

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

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

### 响应

```json
{
  "store": [],
  "file_recycle": false,
  "page": "<div><span class='Pcurrent'>1</span><span class='Pnumber'>1/1</span><span class='Pline'>从1-3条</span><span class='Pcount'>共3条</span></div>",
  "path": "/www/wwwroot",
  "dir": [
    {"nm": "api-demo.bt.local", "sz": 4096, "mt": 1779451143, "acc": "755", "user": "www", "lnk": "", "durl": "", "cmp": 0, "fav": "0", "rmk": "", "top": 0, "sn": "api-demo.bt.local"},
    {"nm": "default", "sz": 4096, "mt": 1779433215, "acc": "755", "user": "root", "lnk": "", "durl": "", "cmp": 0, "fav": "0", "rmk": "", "top": 0, "sn": "default"}
  ]
}
```

