curl-users
ftp upload and directory creation
Date: Fri, 22 Mar 2002 16:57:18 +0100
I am writing the test programs for the CURL ScriptBasic interface and I got
stucked. One of the test programs I want to write uploads recursively all
the files to an ftp server. But it stops with error when it UPLOADs to a
URL, that refers to a nonexisting directory.
How can I make a directory on the remote server?
I assume that I need some FTP QUOT command and thus
curl::option CURL,"QUOTE","something comes here"
is needed, but I could not find it anywhere. (I used google to search.)
Could you save me some time and tell, how this has to be done?
Regards,
Peter
P.S.: I copy here the program, though there is no publicly available
intrerpreter yet to execute it. [ the password is not real ]
declare option DeclareVars
global STARTDIR$,URL$,CURL,FILE$
import curl.bas
import re.bas
on error goto curle
STARTDIR$ = ".."
open directory STARTDIR$ pattern "*" option SbCollectRecursively as 1
while not eod(1)
FILE$ = NextFile(1)
if not re::match(FILE$,"CVS") then
URL$ = "ftp://127.0.0.1/testdir/" & FILE$
CURL = curl::init()
curl::option CURL,"URL",URL$
curl::option CURL,"USERPWD","cvs:XXX"
curl::option CURL,"UPLOAD"
curl::option CURL,"INFILE", STARTDIR$ & "/" & FILE$
print "Uploading ",FILE$,"\n"
curl::perform(CURL)
curl::finish CURL
print "File ",FILE$," was uploaded to ",URL$,"\n"
end if
wend
close directory 1
stop
curle:
print "***ERROR: ",curl::error(CURL),"\n"
Received on 2002-03-22