FileExists
判断指定的文件是否存在,语法:
FileExists(FileName)
FileName:要判断的文件名,含路径。
示例
Dim ftp1 As New FtpClient
ftp1.Host="196.128.143.28"
ftp1.Account = "foxuser"
ftp1.Password = "138238110"
If ftp1.FileExists("\photo\jz.png") Then '如果存在则下载
If ftp1.Download("\photo\jz.png","c:\data\jz.png") Then
messagebox.Show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
messagebox.Show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Else
messagebox.Show("此文件不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If