I'm not sure, but the code I posted up seems to work?

I had an issue where, basically, a CWD command would fail when changing 
between directories that are 3 or 4 layers deep.  For some reason the code I 
posted works most of the time (don't ask me why), but like I said it still 
occasionally fails.

Just to clarify, these are directories that I KNOW exist - I'm doing a 
recursive download from an FTP site.  How would you recommend I recover from 
a failed CWD command?

Cheers

Rick

                Date: Sun, 8 Oct 2006 13:03:20 +0200
From: "Gunnar" <[EMAIL PROTECTED]>
Subject: Re: [twsocket] How to handle a failed CWD with FTPClient...
To: "ICS support mailing" <twsocket@elists.org>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original

Rick,

if CWD fails, why do you expect it could work if you just try it again?

-gunnar
----- Original Message ----- From: "rick cusimano" <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Sunday, October 08, 2006 12:42 PM
Subject: [twsocket] How to handle a failed CWD with FTPClient...

                Hi,

I've been having some issues with FTPClient where sometimes, on some 
servers, it would fail to change the working directory (thanks to whoever 
pointed that out btw)

I've been trying to change the code to test for this and I thought I had it 
cracked, but its still not quite right.

This is the code which seems to work best so far, but it still occasionally 
fails:

if not(Cwd) then
begin
   Quit;
   Connect;
   HostDirName := SubDir;
   Cwd;
end;

This is part of a function which retrieves a file listing, which is then 
passed onto another function which attempts to download each file.  I also 
tried the following code, which I thought made more sense:

if not(Cwd) then
begin
   Quit;
   HostDirName := SubDir;
   if not(Connect) then exit;
end;

With the intention being that if after 2 attempts you still can't get a file 
listing, just skip it.  Unfortunately this seemed to make it go completely 
mental so it must be doing something odd.

Any suggestions please?

Cheers

Rick


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to