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

cURL create new directory using --ftp-create-dir

所以我知道 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