GetDir
获取指定路径下的目录和文件列表,支持分页、排序、搜索。返回每项的详细信息(大小、权限、修改时间等)。
- 路由:
POST /files - action:
GetDir
输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| action | 是 | String | 固定值 GetDir |
| path | 是 | String | 目录路径,如 /www/wwwroot/testapi.bt.local |
| p | 否 | Integer | 页码,默认 1 |
| search | 否 | String | 搜索关键词 |
| sort | 否 | String | 排序字段:name/size/mtime/permission/owner |
输出参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| PATH | String | 当前路径 |
| DIR | Array | 子目录列表,每项格式:name;size;mtime;permission;owner;... |
| FILES | Array | 文件列表,格式同上 |
| PAGE | String | 分页 HTML |
| STORE | Array | 收藏的路径列表 |
| FILE_RECYCLE | Boolean | 是否开启回收站 |
示例
请求
POST /files HTTP/1.1
Content-Type: application/x-www-form-urlencoded
request_time=1700000000&request_token=xxx&action=GetDir&path=/www/wwwroot/testapi.bt.local&p=1
响应
{
"PATH": "/www/wwwroot/testapi.bt.local",
"DIR": [],
"FILES": ["404.html;138;1779435866;644;www;;0;0;0;0;;0", "index.html;917;...;644;www;..."],
"PAGE": "<div>分页</div>",
"STORE": [],
"FILE_RECYCLE": false
}