curl-users
Re: ftp using a configuration file
Date: Wed, 12 Sep 2007 10:05:49 -0700 (PDT)
Using a config file, how do you upload multiple files to the same ftp server? Based on the command line example in the docs (curl -T "{file1,file2}" http://www.uploadtothissite.com ), I am trying this:
curl -v -K curlconfig
where curlconfig contains:
url = "ftp.mysite.com/mydir/"
-u me:guess
-T "{uploadfileA,uploadfileB}"
I tried without or only with double quotes, without or only with the curly braces, but I keep getting a file not found error. It works if I upload only one file with -T myfile
Secondary question: How do you emulate the ftp 'lcd' command in a config file? Is it better to have -T /mypath/myfile, i.e. specify the full path for every file?
The reason we are using a config file is due to the fact that our application generates first the config files. A ftp batch processor then processes all the requests at a specific time. So, all the data necessary for the ftp operation needs to be in the config file, since the requests go against multiple sites, etc...
Thanks again for an excellent product that we use very successfully in other areas!
----- Original Message ----
From: Daniel Stenberg <daniel@haxx.se>
To: the curl tool <curl-users@cool.haxx.se>
Sent: Saturday, September 8, 2007 1:28:41 PM
Subject: Re: ftp using a configuration file
On Fri, 7 Sep 2007, Chris Glon wrote:
> Is it possible to emulate Unix "ftp -n < instruction file", where the
> insruction file contains all the different parameters necessary to perform
> an ftp operation: Host name, user, pwd, upload directory, file name to
> upload, ...
Most of those options are normally given in a single URL to curl. A few others
are given with other command line options.
> Reading the manual, it sounds that -K may be the option to use, but how?
-K takes a file from which it reads further command line options from.
Like this:
curl -K config
and within the file "config" you can lines written in this style:
--- start ---
url = "http://moo.moo.moo/
basic
--create-dirs
-d "post data"
--- end ---
You can specify the command line options with dash, the long names with double
dashes or you can specify the long names without dashes. The important thing
is that the argument for each option must be given on the same physical line.
You can add comments with lines starting with # and you can have empty lines.
> And what is the best way in that case to monitor what is going on between
> the 2 servers: -v?
Yes, or --trace or --trace-ascii if you want even more details.
--
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-09-12