一、新建目录(目录名后面一定要带/)
[root@hlcc_slave logs]# curl -v -X MKCOL http://114.255.71.xxx:18800/dir-test/ -u hlccdav Enter host password for user 'hlccdav': * About to connect() to 114.255.71.xxx port 18800 (#0) * Trying 114.255.71.xxx... * Connected to 114.255.71.xxx (114.255.71.xxx) port 18800 (#0) * Server auth using Basic with user 'hlccdav' > MKCOL /dir-test/ HTTP/1.1 > Authorization: Basic aGxjY2Rhdjp1QWs0YXptUw== > User-Agent: curl/7.29.0 > Host: 114.255.71.xxx:18800 > Accept: */* > < HTTP/1.1 201 Created < Server: nginx < Date: Wed, 03 Aug 2022 06:14:45 GMT < Content-Length: 0 < Location: http://114.255.71.xxx:8800/dir-test/ < Connection: keep-alive < Keep-Alive: timeout=300 < * Connection #0 to host 114.255.71.xxx left intact [root@hlcc_slave logs]#
二、上传文件
[root@hlcc_slave logs]# curl -v -T cti-api.log http://114.255.71.xxx:18800 -u hlccdav Enter host password for user 'hlccdav': * About to connect() to 114.255.71.xxx port 18800 (#0) * Trying 114.255.71.xxx... * Connected to 114.255.71.xxx (114.255.71.xxx) port 18800 (#0) * Server auth using Basic with user 'hlccdav' > PUT /cti-api.log HTTP/1.1 > Authorization: Basic aGxjY2Rhdjp1QWs0YXptUw== > User-Agent: curl/7.29.0 > Host: 114.255.71.xxx:18800 > Accept: */* > Content-Length: 7414504 > Expect: 100-continue > < HTTP/1.1 100 Continue * We are completely uploaded and fine < HTTP/1.1 201 Created < Server: nginx < Date: Wed, 03 Aug 2022 06:16:37 GMT < Content-Length: 0 < Location: http://114.255.71.xxx:8800/cti-api.log < Connection: keep-alive < Keep-Alive: timeout=300 < * Connection #0 to host 114.255.71.xxx left intact [root@hlcc_slave logs]#
三、重命名文件
[root@hlcc_slave logs]# curl -v -X MOVE --header 'Destination:http://114.255.71.xxx:18800/cti-api-new.log' http://114.255.71.xxx:18800/cti-api.log -u hlccdav Enter host password for user 'hlccdav': * About to connect() to 114.255.71.xxx port 18800 (#0) * Trying 114.255.71.xxx... * Connected to 114.255.71.xxx (114.255.71.xxx) port 18800 (#0) * Server auth using Basic with user 'hlccdav' > MOVE /cti-api.log HTTP/1.1 > Authorization: Basic aGxjY2Rhdjp1QWs0YXptUw== > User-Agent: curl/7.29.0 > Host: 114.255.71.xxx:18800 > Accept: */* > Destination:http://114.255.71.xxx:18800/cti-api-new.log > < HTTP/1.1 204 No Content < Server: nginx < Date: Wed, 03 Aug 2022 06:18:09 GMT < Connection: keep-alive < Keep-Alive: timeout=300 < * Connection #0 to host 114.255.71.xxx left intact [root@hlcc_slave logs]#
[hlykf@hlcc_master fs1]$ ll total 7244 drwxrwxr-x 3 hlykf hl95 18 Aug 1 16:54 100000 -rw-rw-r-- 1 hlykf hl95 7414504 Aug 3 13:52 cti-api-new.log drwxrwxr-x 2 hlykf hl95 6 Aug 3 13:50 dirtest drwxr-xr-x 2 hlykf hl95 6 Aug 2 10:48 test [hlykf@hlcc_master fs1]$
四、删除文件
[root@hlcc_slave logs]# curl -v -X DELETE http://114.255.71.xxx:18800/cti-api-new.log -u hlccdav Enter host password for user 'hlccdav': * About to connect() to 114.255.71.xxx port 18800 (#0) * Trying 114.255.71.xxx... * Connected to 114.255.71.xxx (114.255.71.xxx) port 18800 (#0) * Server auth using Basic with user 'hlccdav' > DELETE /cti-api-new.log HTTP/1.1 > Authorization: Basic aGxjY2Rhdjp1QWs0YXptUw== > User-Agent: curl/7.29.0 > Host: 114.255.71.xxx:18800 > Accept: */* > < HTTP/1.1 204 No Content < Server: nginx < Date: Wed, 03 Aug 2022 06:19:26 GMT < Connection: keep-alive < Keep-Alive: timeout=300 < * Connection #0 to host 114.255.71.xxx left intact [root@hlcc_slave logs]
[hlykf@hlcc_master fs1]$ ll total 0 drwxrwxr-x 3 hlykf hl95 18 Aug 1 16:54 100000 drwxrwxr-x 2 hlykf hl95 6 Aug 3 13:50 dirtest drwxr-xr-x 2 hlykf hl95 6 Aug 2 10:48 test [hlykf@hlcc_master fs1]$
五、下载文件
curl -v http://hlmedia:8800/remove_solr.log -uhlccdav -O Enter host password for user 'hlccdav': % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 172.28.17.156:8800... * Connected to hlmedia (172.28.17.156) port 8800 (#0) * Server auth using Basic with user 'hlccdav' > GET /remove_solr.log HTTP/1.1 > Host: hlmedia:8800 > Authorization: Basic aGxjY2Rhdjp1QWs0YXptUw== > User-Agent: curl/7.71.1 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Server: Tengine < Date: Wed, 23 Aug 2023 03:35:52 GMT < Content-Type: application/octet-stream < Content-Length: 245 < Last-Modified: Wed, 23 Aug 2023 03:24:09 GMT < Connection: keep-alive < Keep-Alive: timeout=300 < ETag: "64e57bd9-f5" < Accept-Ranges: bytes < { [245 bytes data] 100 245 100 245 0 0 119k 0 --:--:-- --:--:-- --:--:-- 119k * Connection #0 to host hlmedia left intact