采用Go或编程其他语言实现一个文件跨目录复制、文件移动的 http web server
$ tree .
.
├── demo
│ ├── test.png
│ └── 腾讯云AI代码助手.mp4
├── go.mod
├── go.sum
├── main.go
├── delivery-test-case.sh
├── README.md
仓库说明 初始的文件放在 demo 目录之中,用于实验,README.md是操作说明文档。
文件复制 可通过接口实现文件的复制,route 为 /copy,可跨目录复制( demo),复制过程中可实现更改名称,复制后即为 2 份数据,如果目录不存在需要自动创建。例如 腾讯云AI代码助手.mp4
--->
delivery-test/腾讯云AI代码助手.mp4。
20 个字符以内,例如 delivery-test,目录不存在时需要默认创建50 个字符以内,例如 腾讯云AI代码助手.mp4文件移动: 可通过接口实现实现文件的移动,path 为 /move,移动过程中不允许更改名称,且如果目录不存在需要自动创建。例如: delivery-test/腾讯云AI代码助手.mp4.mp4
---> test/delivery-test/腾讯云AI代码助手.mp4.mp4
go run main.godelivery-test-case.sh,该脚本会执行以下命令
// 文件复制 copy-file.sh
curl -X POST -H "Content-Type: application/json" -d '{"src":"demo/test.png","dst":"delivery-test/test2.png"}' localhost:51800/copy
// 文件移动 mv-file.sh
curl -X POST -H "Content-Type: application/json" -d '{"src":"demo/test.png","dst":"delivery-test/test2.png"}' localhost:51800/movejson 格式传递