User (Old forums)MemberOctober 30, 2003 at 11:14 amPost count: 23064
How do I check if a file exists before I attempt to delete it using the XCeed FTP Control?
Is it necessary?
If File X exists I want to delete it.
If I call
and the file does not exist will I get an error?
Imported from legacy forums. Posted by RDC (had 6465 views)User (Old forums)MemberNovember 6, 2003 at 9:31 amPost count: 23064
If you call DeleteFile on a file that does not exist, the server with indeed return an error reply, and the method will fail with an error. The reply code affects the error we return, but it should normally be FTP_E_OPENREMOTEFILE (0x80042013). But then again, a server could decide to return the same reply if you don’t have the rights to delete that file, or if it’s in use, etc.
To make sure the file is there, you can call GetFolderContents with that filename as the mask. The method should return one entry if the file exists, or none if it doesn’t.
Imported from legacy forums. Posted by Martin (had 546 views)User (Old forums)MemberAugust 22, 2005 at 11:37 amPost count: 23064
I am getting various run-time errors when the mainframe file I am trying to download is either empty, has not been defined, or was open in another partition. I read this posting and decided to try the GetFolderContents to determine if a mainframe file exists before running FTP1.ReceiveFile. I assumed it was part of the package but of course got the “function not defined” error. Is there another way to test for the various run-time errors (indicating that the file is not there) prior to executing the receive command??
Imported from legacy forums. Posted by SCJ (had 537 views)User (Old forums)MemberAugust 22, 2005 at 12:12 pmPost count: 23064
I don’t understand why you get that “Function not defined”, since the GetFolderContents method is indeed part of the Xceed FTP Library:
Imported from legacy forums. Posted by Martin (had 417 views)User (Old forums)MemberAugust 22, 2005 at 4:23 pmPost count: 23064
Thank you for the quick response. I got the error message because I did not have the GetFolderContents syntax correct. Now that I have fixed that problem, what will I get back from an MVS mainframe? If I use the shortname of the mainframe file I am downloading as the mask name, will I get a zero if the file is there and something else if it’s not?
Imported from legacy forums. Posted by SCJ (had 5492 views)
- You must be logged in to reply to this topic.