cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problems creating a directory tree with FTP

From: Gerard Cheng <cheng_at_vertigoxmedia.com>
Date: Wed, 31 Jul 2002 17:23:14 -0400

I am trying to find a way to create a directory tree on a
remote FTP site if it does not already exist. But I am
running into problems with FTP and was hoping there is an
easier way to handle this with libCurl.

I want to create a directory tree from the root FTP directory
of the form:
        a/b/c

Since FTP doesn't seem to have an equivalent to "mkdir -p",
I am using CURLOPT_QUOTE to send a series of FTP commands
like this:
        MKD a
        MKD a/b
        MKD a/b/c

However, if any of the subdirectories already exists, the
curl_easy_perform() fails with error "CURLE_FTP_QUOTE_ERROR"
and does not try to FTP the file.

I thought I could test if the subdirectory already exists
by trying to CWD to it, but then I have no way of conditionally
calling the MKD if this fails. Does anyone know of a way
to get around this problem?

Thanks in advance!

Ged

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=3D31
Received on 2002-07-31