cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Something Stpid?

From: Charlie Bursell <charlie.Bursell_at_quovadx.com>
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: 'curl-library_at_cool.haxx.se'
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 ftp://10.10.170.62/%2fsomewhere/somedir/ \

    -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
ftp://10.10.170.62/%2fsomewhere/somedir/$file \

                                     -userpwd mylogin:mypaswd \

                                     -ftpresponsetimeout 20 \

                                    -bodyvar txtFile \

                        - errorbuffer errMsg

 

                        $curlHandle perform

            }

}

 

$curlHD cleanup

 
Received on 2007-06-19