WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Check if FTP File Exists FtpExist iFtpExist FtpFileExist iFtpFileExist


#DefineFunction MyFtpFileExist(conhandle, ftpdirectory, ftpfile)
   ;Case insensitve ftp file name search
   If StrTrim(ftpdirectory) != ""
      iFtpDirChange ( conhandle, ftpdirectory)
   EndIf
   ret=iFtpFindInit(conhandle,"",ftpfile,@TRUE,@FALSE)
   If ret==0
     Message("IFtpFindInit?","Failed")
     Return 0
   EndIf
   rslt=0
   While 1
      file=iFtpFindNext(@FALSE)
      If file=="" Then Break
      rslt=1
   EndWhile
   iClose(ret)
   Return rslt
#EndFunction


host = "ftp.windowware.com"
userid = ""
pswd = ""
ftpdirectory = "/wwwftp/wb01/"
ftpfile = "wil-lang.pdf"

AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
conhandle=iHostConnect(tophandle, host, @FTPPASSIVE, userid, pswd)
If conhandle==0
 Message("ERROR","Unable to connect to host")
 Exit
EndIf

result = MyFtpFileExist(conhandle, ftpdirectory, ftpfile)
If result == 1
  Message(StrCat(ftpdirectory,ftpfile),"Exists")
Else
  Message(StrCat(ftpdirectory,ftpfile),"Does Not Exist")
EndIf

iClose(conhandle)
iClose(tophandle)

Article ID:   W16371
File Created: 2017:07:28:13:58:45
Last Updated: 2014:06:19:10:15:19