cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problem uploading to a subdirectory

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 24 Jan 2012 13:39:25 -0800

On Tue, Jan 24, 2012 at 04:21:26PM -0500, Scott MacDonald wrote:
> I can access and upload to the default directory but if I try to list or
> upload to the subfolder "in" I get errors.
>
> The following works:
>
> # curl -k -u user:pass --ftp-ssl ftp://ftp.url.com:2130
>
> And returns:
>
> drwxr-x--- 2 gcs21si System 0 Jan 24 03:36 .
> drwxr-x--- 2 gcs21si System 0 Jan 10 11:45 ..
> drwxr-x--- 2 gcs21si System 0 Jan 23 19:01 Archive
> drwxr-x--- 2 gcs21si System 0 Jan 23 14:58 In
> drwxr-x--- 2 gcs21si System 0 Jan 24 13:11 Out

The directory here is called "In", not "in". If the server is case
sensitive, this will make a difference.

> # curl -k -T tfile -u user:pass --ftp-ssl ftp://ftp.url.com:2130
>
> Also works and uploads the file.
>
> When I try to access the subfolder "in" with either of these paths I get the
> errors indicated.
>
> # curl -k -u user:pass --ftp-ssl ftp://ftp.url.com:2130/users/user/in
> I get curl: (9) Server denied you to change to the given directory

If you're trying to get a directory listing, you need to put a slash
character at the end of the URL, i.e., ftp://ftp.url.com:2130/users/user/in/
The command-line you gave attempts to download a file called "in".

> I've found the solution using -Q. The following works for me:
>
> # curl -k -T tfile -u user:pass --ftp-ssl -Q "CWD in" ftp://ftp.url.com:2130

This is dangerous--it bypasses curl's internal working directory state
and will cause errors if you attempt to do further transfers over the
same connection.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-24