curl-and-php
Re: Moving files on an FTP server via libcurl
Date: Wed, 27 Jun 2007 20:53:30 +0200
I thought the FTP rename syntax was:
rename [oldfile] [newfile]
or
RNFR [oldfile]
RNTO [newfile]
Vipin hegde wrote:
> I'm trying to connect upto a secure FTP site (using PHP +
> libcurl) which has the following folder structure:
>
> /datafiles
> /old_datafiles
>
> I can connect to the server, but all the approaches I've tried to move
> the files which reside in the "datafiles" folder over to the
> "old_datafiles" subfolder, have failed. Here's the code i have so far:
>
>
> $cobj = curl_init();
> curl_setopt($cobj, CURLOPT_URL, $ftp_url);
> curl_setopt($cobj, CURLOPT_RETURNTRANSFER,1);
> curl_setopt($cobj, CURLOPT_VERBOSE, 1);
> curl_setopt($cobj, CURLOPT_USERPWD, $username . ":" . $password);
> curl_setopt($cobj, CURLOPT_FTP_USE_EPSV, 0);
> curl_setopt($cobj, CURLOPT_FTP_USE_EPRT, 0);
> curl_setopt($cobj, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
> curl_setopt($cobj, CURLOPT_SSL_VERIFYPEER, 0);
> curl_setopt($cobj, CURLOPT_SSL_VERIFYHOST, 0);
> curl_setopt($cobj, CUROPT_POSTQUOTE, array("RENAME $filename TO
> old_datafiles/$filename"));
>
>
>
>
> Any help in finding a solution would be greatly appreciated !
>
> --
> Regards,
> Vipin
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-06-27