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.

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

Article ID:   W15436
File Created: 2003:05:13:11:27:46
Last Updated: 2003:05:13:11:27:46