cURL 使用 --ftp-create-dir 创建新目录

标签 curl sftp

所以我知道这个问题之前有人问过here ,但答案对我不起作用。我正在使用 SFTP 连接到我的服务器:

curl -k -v sftp://<username>:<password>@12.34.56.78/subdomains/cdn/mynewdir --ftp-create-dirs

输出:

*Trying 12.34.56.78
*TCP_NODELAY set
*Connected to 12.34.56.78 (12.34.56.78) port 22 (#0)
*SSH MD5 fingerprints: ab12cd34ef56gh78lm98
*SSH authentication methods available: password
*Initialized password authentication
*Authentication complete
*Could not open remote file for reading: no such file or directory
*Connection #0 to host 12.34.56.78 left intact
curl: (78) Could not open remote file for reading: No such file or directory

我知道身份验证没有问题,因为我可以看到我的文件和其他目录,但我似乎无法使用 --ftp-create-dirs 创建新目录。

感谢任何一点帮助。

最佳答案

我通过执行以下操作自行修复了它:

curl -k -v "sftp://<username>:<password>@12.34.56.78/subdomains/cdn/"
     -Q "-MKDIR /subdomains/cdn/mynewdir" --ftp-create-dirs

关于cURL 使用 --ftp-create-dir 创建新目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49286269/

相关文章:

php - Laravel 5.2 Socialite Facebook 登录 cURL 错误 60

php - 使用 sftp 和 ssh2 的 fopen 段错误

c# - SharpSSh : Restart file transfer if current file transfer too slow?

node.js - 使用sftp和socks5代理node.js

c++ - 安装 cURL 后 undefined reference

python - python 请求模块和 curl 的不同结果

php - 使用 PHP 的 FedEx Shipping API

php - ssh 或 cURL 将数据发送到远程服务器

linux - sftp 上传 bash 忽略文件

macos - 如何 SFTP 到 Amazon EC2 Ubuntu t1.micro 实例?