Deepa
Deepa

Reputation: 11

libcurl and mkdir

I need to use libcurl for creating a folder in my home directory. I use the following set of code for this:

struct curl_slist *headers = NULL; 
headers = curl_slist_append(headers, "mkdir MyFolder"); 
curl_easy_setopt(curl, CURLOPT_QUOTE, headers); 

I have given the ftp server-path, user name, password. But, I get the error '500 COmmand not understood'.

I tried using 'pwd' command instead of 'mkdir MyFolder'. It worked without any error.

Can some one help me out to solve this problem.

Thanks in advance.

Upvotes: 0

Views: 2771

Answers (2)

Jonathan Leffler
Jonathan Leffler

Reputation: 753725

Since MKD (MKDIR) is an optional command in the FTP protocol, maybe the FTP server is configured not to allow it? Can you do the MKD on the target server when you connect manually?

Upvotes: 0

Ross
Ross

Reputation: 241

You should probably use MKD instead of mkdir.

See FILE TRANSFER PROTOCOL (FTP) RFC0959.

Upvotes: 2

Related Questions