分享页面

Debian下使用curl操作ftp上传和下载

1.文件上传

curl --ftp-create-dirs -T ./main.py ftp://test:testpasswd123123@45.x.x.136/main.py

img

—ftp-create-dirs 代表在ftp上自动创建目标文件夹。

-T 上传文件

ftp目标路径:

ftp://test:testpasswd123123@45.x.x.136/

test是ftp用户名

testpasswd123123是ftp密码,需要注意密码中包含特殊字符时需要转码

2.文件下载

查看目录下面的文件

curl ftp://username:password@192.168.10.91:21/

最后一定要加斜杠“/”,否则报错

img

下载文件到本地

curl ftp://test:testpasswd123123@45.x.x.136/main.go -o main.go.bak

img

这里用到的参数是 -o,注意参数位置,不在最前面。

本文导读