Sub App_Start
Form1.Show
ftp.New1
ftp.Open("ftp.ftpplanet.com","","") 'No user name or password
required here.
ftp.SetCurrentDirectory("images")
table1.AddCol(cString,"name",60)
table1.AddCol(cString,"date",60)
table1.AddCol(cNumber,"size",60)
FillEntries
End Sub
Sub FillEntries 'Fills the table with the directories and files
entries() = ftp.GetEntries("",true) 'Get all subdirectories first.
for i = 0 to
arraylen(entries())-1 step 3 'Each
entry includes 3
values: name, date (ticks) and size.
table1.AddRow(entries(i),date(entries(i+1)),entries(i+2))
next
entries() = ftp.GetEntries("",false) 'Get all files now.
for i = 0 to
arraylen(entries())-1 step 3
table1.AddRow(entries(i),date(entries(i+1)),entries(i+2))
next
End Sub
Sub btnDownload_Click
WaitCursor(true)
name = table1.Cell("name",table1.SelectedRow)
ftp.GetFile(name,AppPath & "\" & name)
WaitCursor(false)
End Sub
Sub Form1_Close
ftp.Close 'Close the connection.
End Sub