cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: problem with CURL

From: jayjwa <jayjwa_at_atr2.ath.cx>
Date: Fri, 15 Apr 2005 22:04:35 -0400

>>>
I want to automate a process to upload the file to a ftp site via a http
proxy.

The command i am using is :

curl -x proxy:port -T filename ftp://ftpsite

IF I have a folder /test/upload/ and there are 10 files with different
filenames and this filenames go on changing daily, how do i add this to
the curl command?

Note: This folder /test/upload is populated with new file daily with
different names and old files once uploaded are removed.
>>>

How about a cron job that runs daily, calling a script which in turn steps
thru the list of files, calling curl to upload them one at a time. Put the
command to upload in an "if" expression and base whether or not the upload
was successful on curl's return value. If it returns OK, delete the file
and step on to the next. If it fails for whatever reason, do (whatever
you'd do if it fails, eg, try later, move the file, mail a message or
whatever.) The variable containing the filename will be replacing the "-T"
value, like "-T /test/upload/${uploading_file}"

You also didn't say the proxy HAD to be a certain one, if one doesn't
work, maybe try another? This could go in the script as well, inside the
loop, or test if a "test upload" works first before curl goes on and tries
sending all the real uploads. If the server allows CONNECT, try
--proxytunnel instead of -x. Those servers are usually more flexible.

-- 
MS09-99896 - Vulnerability in All MS Windows OS 
Using Windows Could Allow Remote Code Execution
"Microsoft finally admitted today that you just
shouldn't use Windows for anything. Period." 
Received on 2005-04-16