Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Create Logfile of FTP Session

Keywords: 	 ftp logfile

Question:

Is there a way to log results of an FTP session, or saving a directory listing of resulting structure after completing.

Answer:

AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
conhandle=iHostConnect(tophandle,"ftp.windowware.com",@FTP, "", "")
if conhandle==0
 message("ERROR","Unable to connect to host")
 exit
endif

a=iFtpFindInit(conhandle,"/wwwftp/wilson/archives/","*.*",@True,@False)
   if a==0
      message("IFtpFindInit?","Failed")
      exit
   endif

currdir=iFtpDirGet(conhandle)

BoxOpen("Ftp Search","Initializing")
Winzoom("Ftp Search")
x=0

logfile="c:\temp\ftp\ftp.log"
handle=FileOpen(logfile,"WRITE")
FileWrite(handle,strcat(currdir,@crlf))

While 1
   file=iFtpFindNext(@True)
   if file=="" then break
   x=x+1
   Boxtext(strcat("number of files ",x,@CRLF,file))
;   FileWrite(handle, ItemExtract(1,file,@tab))
    FileWrite(handle,file)
   timedelay(0.5)
endwhile
FileClose(handle)
   
iClose(a)
iClose(conhandle)
iClose(tophandle)
Message("All","Done")
exit