Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

curl

sftp

So I know this question has been asked before here, but the answer doesn't work for me. I'm connecting to my server using SFTP:

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

Output:

*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

I know there's nothing wrong with the authentication, because I can see my files and other directories, but I just can't seem to create new directories using --ftp-create-dirs.

Any bit of help is appreciated.

like image 707
YTZ Avatar asked Aug 25 '26 07:08

YTZ


1 Answers

I fixed it myself by doing the following:

curl -k -v "sftp://<username>:<password>@12.34.56.78/subdomains/cdn/"
     -Q "-MKDIR /subdomains/cdn/mynewdir" --ftp-create-dirs
like image 186
YTZ Avatar answered Aug 26 '26 23:08

YTZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!