cURL / Mailing Lists / curl-library / Single Mail


RE: Something Stpid?

From: Charlie Bursell <>
Date: Tue, 19 Jun 2007 13:25:16 -0600

To follow up n this.


If I insert the command "$curlHandle reset" (See Below) prior to each
iteration of th e foreach loop, it works as expected.


Should I have to do this?



From: Charlie Bursell
Sent: Tuesday, June 19, 2007 1:12 PM
To: ''
Subject: Something Stpid?


I know I must be doing something stupid here, but I can't figure it out.
In the script below, I get a list of all files in the directory as
expected. Then I try to get the *.txt files in a local variable,
tctFile. If I look at the contents of txtFile after each iteration I
see a directory listing and not the contents of the file. What am I
doing wrong?



set curlHandle [curl::init]


$curlHandle configure -url \

    -userpwd mylogin:mypaswd \

    -ftpresponsetimeout 20 \

    -ftplistonly 1 \

    -bodyvar fileList \

    -errorbuffer errMsg


$curlHandle perform


foreach file $fileList {

            if {[string tolower [file extension $file]] eq ".txt"} {



                        # ADDED THIS TO MAKE IT WORK!

                        $curlHandle reset



                        $curlHandle configure -url$file \

                                     -userpwd mylogin:mypaswd \

                                     -ftpresponsetimeout 20 \

                                    -bodyvar txtFile \

                        - errorbuffer errMsg


                        $curlHandle perform




$curlHD cleanup

Received on 2007-06-19