quinta-feira, 4 de fevereiro de 2016

Deletar arquivo em pasta FTP com VB.Net

Imports System.Net.Mail
Imports System.Net
Imports System.IO
Public Sub DeletarFtp(ByVal Arquivo As String, ByVal Usuario As String, ByVal Senha As String)
     Dim filename As String = "ftp://xxx.xxx.xxx.xxx/" & Arquivo
     Dim ftpReq As FtpWebRequest = WebRequest.Create(filename)
     ftpReq.Method = WebRequestMethods.Ftp.DeleteFile
     ftpReq.Credentials = New NetworkCredential(Usuario, Senha)
     Dim ftpResp As FtpWebResponse = ftpReq.GetResponse
End Sub

Nenhum comentário:

Postar um comentário