cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl: using sftp or ftp upload, changing file name after upload is done...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 24 Mar 2009 19:58:09 +0100 (CET)

On Tue, 24 Mar 2009, Miguel Costa wrote:

> i've tried to do an upload function to upload a file and then change the
> name of the file.
>
> i use the same function for SFTP or FTP but what i really want is SFTP so i
> will be fine if FTP doesn't work.

SFTP and FTP require entirely different commands to do the renaming.

> /* commands to change the file num after upload is done */
> sprintf(buf_1, "RNFR %s", upfile);
> sprintf(buf_2, "RNTO %s", renamefile);

These are FTP commands, they won't work for SFTP. On SFTP you do something
like:

   sprintf(buf_1, "rename %s %s", upfile. renamefile);

-- 
  / daniel.haxx.se
Received on 2009-03-24