回复 11楼d990213m的帖子
按照您的示例,如果已经存在几个文件,想要压缩到指定的路径下。
主要通过创建zip文件,然后将指定文件添加到zip文件中。
代码参考:
- Public Class Form1
- Private m_Zip As C1ZipFile
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim strTextFileName(2) As String
- Dim strFileName As String = "F:\123.zip"
- Try
- m_Zip.Create(strFileName)
- Catch
- MessageBox.Show("Can't create ZIP file, please try again.", "C1Zip")
- End Try
- strTextFileName(0) = "F:\test1.txt"
- strTextFileName(1) = "F:\test2.txt"
- For i = 0 To 1
- m_Zip.Entries.Add(strTextFileName(i))
- Next
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- m_Zip = New C1ZipFile()
- End Sub
- End Class
复制代码 |