我想制作一个程序,该程序通过Cpanel文件管理器进行压缩,并获取public_html文件夹并进行压缩(或在文件管理器中下载该public_html的整个文件夹)。那可能吗?如果有可能这样做的参考吗?我正在使用vb.net来制作此程序。
编辑: 我正在使用vb.net自动为public_html备份
我有从FTP下载的文件,但是我不知道如何下载整个文件夹。
Sub FTPDownloadFile(ByVal downloadpath As String, ByVal ftpuri As String, ByVal ftpusername As String, ByVal ftppassword As String)
'Create a WebClient.
Dim request As New WebClient()
' Confirm the Network credentials based on the user name and password passed in.
request.Credentials = New NetworkCredential(ftpusername, ftppassword)
'Read the file data into a Byte array
Dim bytes() As Byte = request.DownloadData(ftpuri)
Try
' Create a FileStream to read the file into
Dim DownloadStream As FileStream = IO.File.Create(downloadpath)
' Stream this data into the file
DownloadStream.Write(bytes, 0, bytes.Length)
' Close the FileStream
DownloadStream.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Sub
End Try
End Sub
至于为此
FTPDownloadFile("C:\Users\SGTSI-PROD\Desktop\w\BACKUP " & Format(DateTime.Now.ToString("MMMM-dd-yyyy")) & ".rar", "ftp://localhost/BACKUP " & Format(DateTime.Now.ToString("MMMM dd yyyy")) & ".rar", "testuser1", "123123123")