Re: [twsocket] How to handle a failed CWD with FTPClient...
> Thanks for all your help, guys. Yes that makes a lot of sense. I didn't > realise CWD only changed directory RELATIVE to the current directory. Not exactly. CWD change directorie according to what you pass as argument. If you pass an absolute directory, so does it change. If you pass a relative directory, it change accordingly ! As I said in one of my previous messages, when you lon onto a FTP server, you are not in the "root directory", you are in the "home directory" which may or may not be the same as the root directory. Use PWD to know where you are logged in. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be - Original Message - From: "rick cusimano" <[EMAIL PROTECTED]> To: Sent: Wednesday, October 11, 2006 9:15 AM Subject: Re: [twsocket] How to handle a failed CWD with FTPClient... > Thanks for all your help, guys. Yes that makes a lot of sense. I didn't > realise CWD only changed directory RELATIVE to the current directory. > > I've tried adding a '/' to the start of the path, but that didn't work. > I've also tried a '\', but that didn't work either. Whats the easiest way > of changing to the root (or rather, the HOME) directory? I did previously > write a loop where it would CDUP as long as there were a certain number of > '\'s left in the current directory but I scrapped that... > > And thanks again for all your help, this is more support than I've ever > gotten for ANY product I've used > > 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 -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
On Oct 11, 2006, at 03:15, rick cusimano wrote: > Thanks for all your help, guys. Yes that makes a lot of sense. I > didn't > realise CWD only changed directory RELATIVE to the current directory. > > I've tried adding a '/' to the start of the path, but that didn't work. > I've also tried a '\', but that didn't work either. That's because your paths were already relative to another directory. > Whats the easiest way > of changing to the root (or rather, the HOME) directory? I did > previously > write a loop where it would CDUP as long as there were a certain > number of > '\'s left in the current directory but I scrapped that... Without viewing your code, I don't know how you are constructing your paths, but ideally you always want to know where you are in the hierarchy at any time. If you do, then you don't really need to go back to the root after every file operation. In any case, you should be able to go back to the root by issuing CWD('/'). From what I understand, you want to download all the files in the server, and you are building a list of files to give to a second process that will download them. Is this second process traversing the directories to download the files, or just using GET with the full path of each file without changing directories? If it is just GETting the files from where it is, then you must ensure that each filepath you store is either absolute from the root, or relative to the home directory (which could be different, as Francois pointed out). dZ. -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
Thanks for all your help, guys. Yes that makes a lot of sense. I didn't realise CWD only changed directory RELATIVE to the current directory. I've tried adding a '/' to the start of the path, but that didn't work. I've also tried a '\', but that didn't work either. Whats the easiest way of changing to the root (or rather, the HOME) directory? I did previously write a loop where it would CDUP as long as there were a certain number of '\'s left in the current directory but I scrapped that... And thanks again for all your help, this is more support than I've ever gotten for ANY product I've used 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
Warning: The root directory is not necessary the directory where you are when you log into the ftp server which is the "home directory". Home directory and root directory may be the same, but not always. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Tuesday, October 10, 2006 8:34 PM Subject: Re: [twsocket] How to handle a failed CWD with FTPClient... > >> So you should first change the working directory >> to the "root" path and then try the second CWD >> command with the "a\b\c\d" HostDirName ... > > No, that would require an extre round-trip. As > others have pointed out, you should use "absolute" > paths by starting all your paths with a '/' (or '\' > in the case of Windows). If a path does not start > with the directory separator, the server will > interpret it as a path relative to the current directory. > > Since you seem to be dropping the connection whenever > your CWD fails (unnecessary, really), the next time > that you re-connect it'll start again in the top > directory, and so that's why re-trying the same > directory after failing worked. > > -dZ. > > -- > 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 -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
> So you should first change the working directory > to the "root" path and then try the second CWD > command with the "a\b\c\d" HostDirName ... No, that would require an extre round-trip. As others have pointed out, you should use "absolute" paths by starting all your paths with a '/' (or '\' in the case of Windows). If a path does not start with the directory separator, the server will interpret it as a path relative to the current directory. Since you seem to be dropping the connection whenever your CWD fails (unnecessary, really), the next time that you re-connect it'll start again in the top directory, and so that's why re-trying the same directory after failing worked. -dZ. -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
Hi, Isn't CWD command supposed to work from the directory you are in? Example: > HostDirName = '1\2\3\'; > Cwd; // No Failure I think this doesn't fail because the directory "1" is placed inside the current working directory. Wich does not happen in the second CWD: > HostDirName = 'a\b\c\d\'; > Cwd; // ERROR: 550 a\b\c\d\ : The system cannot find the path specified. Where the directory "a" is not inside the directory "3" wich is the current working directory (after the successfull first CWD). So you should first change the working directory to the "root" path and then try the second CWD command with the "a\b\c\d" HostDirName ... I'm shooting in the dark here, for I don't use FTPs much and never used the ICS FTP Client, but it's worth a try ... Regards, Marcelo Grossi - Original Message - From: "rick cusimano" <[EMAIL PROTECTED]> To: Sent: Tuesday, October 10, 2006 2:22 PM Subject: Re: [twsocket] How to handle a failed CWD with FTPClient... > Hello, > > Thanks for pointing out that I can retrieve the last response from the > server, I didn't realise Cwd results came just as a response and not as an > event. > > Ok so this is what happens: > > HostDirName = '1\2\3\'; > Cwd; // No Failure > > HostDirName = 'a\b\c\d\'; > Cwd; // ERROR: 550 a\b\c\d\ : The system cannot find the path specified. > > > But when I reverse the order of the directories: > > > HostDirName = 'a\b\c\d\'; > Cwd; // No Failure > > HostDirName = '1\2\3\'; > Cwd; // ERROR: 550 1\2\3\ : The system cannot find the path specified. > > > The path obviously exists. This error only seems to occur with > directories > 3 or more levels deep, and happens regardless of which server I test it > on. > > Like I said previously the following code seems to fix this problem some > of > the time: > > if not(Cwd) then > begin >Quit; >Connect; >HostDirName := SubDir; >Cwd; > end; > > Can anyone suggest anything else I could try? > > 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 > -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
Hi, Current dir is "\" > HostDirName = '1\2\3\'; > Cwd; // No Failure of course > HostDirName = 'a\b\c\d\'; > Cwd; // ERROR: 550 a\b\c\d\ : The system cannot find the path specified. Haha, no surprise. The server is now looking for \1\2\3\a\b\c\d, and that porbably doesn't exist. Set hostdirname to \a\b\c\d and it will probably work. Best wishes, Gunnar -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
You are using relative paths and so the oerder is very important. If you cwd to 'a\b\c\d\' and then to '1\2\3\' it is the same as doing a cwd to 'a\b\c\d\1\2\3\' at the first place. If you first cwd to '1\2\3\' and then to 'a\b\c\d\', then is is the same to do at once a cwd to '1\2\3\a\b\c\d\'. All those path a relative to the current directory, including the one you have when starting the connection (use pwd to know the current directory). -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "rick cusimano" <[EMAIL PROTECTED]> To: Sent: Tuesday, October 10, 2006 7:22 PM Subject: Re: [twsocket] How to handle a failed CWD with FTPClient... > Hello, > > Thanks for pointing out that I can retrieve the last response from the > server, I didn't realise Cwd results came just as a response and not as an > event. > > Ok so this is what happens: > > HostDirName = '1\2\3\'; > Cwd; // No Failure > > HostDirName = 'a\b\c\d\'; > Cwd; // ERROR: 550 a\b\c\d\ : The system cannot find the path specified. > > > But when I reverse the order of the directories: > > > HostDirName = 'a\b\c\d\'; > Cwd; // No Failure > > HostDirName = '1\2\3\'; > Cwd; // ERROR: 550 1\2\3\ : The system cannot find the path specified. > > > The path obviously exists. This error only seems to occur with > directories > 3 or more levels deep, and happens regardless of which server I test it > on. > > Like I said previously the following code seems to fix this problem some > of > the time: > > if not(Cwd) then > begin >Quit; >Connect; >HostDirName := SubDir; >Cwd; > end; > > Can anyone suggest anything else I could try? > > 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 -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
Send code examples. My guess is that you are in directoy 1\2\3 and then attempting to CWD to a\b\c\d without returning to the parent directory first, so that you are really trying to change to directory 1\2\3\a\b\c\d without realizing it. Sincerely, Brad Gies - NLM Software Southfield, MI, USA - If you get today's work done today, but do it in a way that you can't possibly get tomorrow's work done tomorrow, then you lose. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of rick cusimano > Sent: Tuesday, October 10, 2006 1:23 PM > To: twsocket@elists.org > Subject: Re: [twsocket] How to handle a failed CWD with FTPClient... > > Hello, > > Thanks for pointing out that I can retrieve the last response from the > server, I didn't realise Cwd results came just as a response and not as an > event. > > Ok so this is what happens: > > HostDirName = '1\2\3\'; > Cwd; // No Failure > > HostDirName = 'a\b\c\d\'; > Cwd; // ERROR: 550 a\b\c\d\ : The system cannot find the path specified. > > > But when I reverse the order of the directories: > > > HostDirName = 'a\b\c\d\'; > Cwd; // No Failure > > HostDirName = '1\2\3\'; > Cwd; // ERROR: 550 1\2\3\ : The system cannot find the path specified. > > > The path obviously exists. This error only seems to occur with > directories > 3 or more levels deep, and happens regardless of which server I test it > on. > > Like I said previously the following code seems to fix this problem some > of > the time: > > if not(Cwd) then > begin > Quit; > Connect; > HostDirName := SubDir; > Cwd; > end; > > Can anyone suggest anything else I could try? > > 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 This e-mail or communication, including any attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or legally privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and permanently delete all copies, electronic or other, you may have or from your computer. Any disclosure, copying, distribution, reliance or use of the contents or information received in error is strictly prohibited. The foregoing applies even if this notice is imbedded in a message that is forwarded or attached. -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
Hello, Thanks for pointing out that I can retrieve the last response from the server, I didn't realise Cwd results came just as a response and not as an event. Ok so this is what happens: HostDirName = '1\2\3\'; Cwd; // No Failure HostDirName = 'a\b\c\d\'; Cwd; // ERROR: 550 a\b\c\d\ : The system cannot find the path specified. But when I reverse the order of the directories: HostDirName = 'a\b\c\d\'; Cwd; // No Failure HostDirName = '1\2\3\'; Cwd; // ERROR: 550 1\2\3\ : The system cannot find the path specified. The path obviously exists. This error only seems to occur with directories 3 or more levels deep, and happens regardless of which server I test it on. Like I said previously the following code seems to fix this problem some of the time: if not(Cwd) then begin Quit; Connect; HostDirName := SubDir; Cwd; end; Can anyone suggest anything else I could try? 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
> I was asked to check what error is bought up but unfortunately the FTPClient > component doesn't generate an error via the OnError event (though it does > for other things so I know I'm checking it right). It is likely an error at the application level, that is sent by the FTP server. PLEASE record all messages exchanged between your client and the server, just like the FtpTst demo does. This will surely show the problem. Without it, I surely can't help more. > Could anyone suggest a resolution or a better way to debug what's going on? Trace all messages -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be - Original Message - From: "rick cusimano" <[EMAIL PROTECTED]> To: Sent: Monday, October 09, 2006 10:53 PM Subject: Re: [twsocket] How to handle a failed CWD with FTPClient... > As requested I've done some more testing with this, however I'm not getting > any closer. > > Just to reiterate, I'm trying to do a recursive download from an FTP Server > to basically do a full backup. It works fine most of the time, but > occasionally the Cwd command fails to change directory causing files to be > downloaded in the wrong place. > > I was asked to check what error is bought up but unfortunately the FTPClient > component doesn't generate an error via the OnError event (though it does > for other things so I know I'm checking it right). > > There is no permissions problem - using the same username/password I can > download everything via other FTP programs. The only error I get is that > Cwd = false. > > I managed to trace the problem down to a simple test which fails every time > - there seems to be a bug when changing between directories that are 3 or 4 > layers deep i.e. > > Changing from '1/2/3/' to 'a/b/c/d' causes Cwd to fail. This happens > regardless of which server I try it on and in which order I try to download > the directories. > > Like I said in a previous email, with the following alteration the program > works much better, but still fails on some directories: > > if not(Cwd) then > begin > Quit; > Connect; > HostDirName := SubDir; > Cwd; > end; > > Could anyone suggest a resolution or a better way to debug what's going on? > > 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 -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
rick cusimano wrote: > Could anyone suggest a resolution or a better way to debug what's > going on? If you do not provide the error number as well as the error text, how should anybody know what's going on? When CWD failes log FtpClient1.LastResponse as well as FtpClient1.ErrorMessage. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
> Just to reiterate, I'm trying to do a recursive download from an > FTP Server to basically do a full backup. It works fine most of > the time, but occasionally the Cwd command fails to change > directory causing files to be downloaded in the wrong place. Try using my File Transfer Components that include all the directory recursion as standard. You don't have to install the components to test them, there is an EXE demo that will do it. http://www.magsys.co.uk/delphi/magxfer.asp If you have contributed to ICS-SSL you can download the source from the protected download area. Angus -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
As requested I've done some more testing with this, however I'm not getting any closer. Just to reiterate, I'm trying to do a recursive download from an FTP Server to basically do a full backup. It works fine most of the time, but occasionally the Cwd command fails to change directory causing files to be downloaded in the wrong place. I was asked to check what error is bought up but unfortunately the FTPClient component doesn't generate an error via the OnError event (though it does for other things so I know I'm checking it right). There is no permissions problem - using the same username/password I can download everything via other FTP programs. The only error I get is that Cwd = false. I managed to trace the problem down to a simple test which fails every time - there seems to be a bug when changing between directories that are 3 or 4 layers deep i.e. Changing from '1/2/3/' to 'a/b/c/d' causes Cwd to fail. This happens regardless of which server I try it on and in which order I try to download the directories. Like I said in a previous email, with the following alteration the program works much better, but still fails on some directories: if not(Cwd) then begin Quit; Connect; HostDirName := SubDir; Cwd; end; Could anyone suggest a resolution or a better way to debug what's going on? 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
> 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? I can't recommand anything before knowing the exact error. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
> 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? That doesn't mean that you are allowed to access these directories. If CWD fails, there's a reason for that, usually on server side Then from client side there is nothing you can do to "recover", you can just skip the directory - and complain at the server's admin ... -gunnar -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
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" 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: 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
> 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) What is the error returned by the server or the component ? Knowing the error would help solving the problem. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "rick cusimano" <[EMAIL PROTECTED]> To: 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 -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
On Oct 8, 2006, at 06:42, rick cusimano wrote: > 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) Perhaps its a permission issue? If so, you won't be able to change to that directory regardless of how many times you try. dZ. -- 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
Re: [twsocket] How to handle a failed CWD with FTPClient...
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: 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 > -- 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
[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