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
响应
{"path": "/www/wwwroot", "is_dir": true, "exists": true}