COMPACTAR PASTA USANDO SYSTEM.IO.COMPRESSION
ola amigos, estou querendo compactar pasta com esta class alguem pode me ajudar.
Imports System.IO
Imports System.IO.Compression
Module MTeste
Sub Main()
Dim zipDirPath As String = [Ô]C:\filesToZip[Ô]
Dim DirInfo As DirectoryInfo = New DirectoryInfo(zipDirPath)
For Each currentFileInfo As FileInfo In DirInfo.GetFiles()
Compress(currentFileInfo)
Next
End Sub
Private Sub Compress(ByVal currentFileInfo As FileInfo)
Using inFile As FileStream = currentFileInfo.OpenRead()
If (File.GetAttributes(currentFileInfo.FullName) And FileAttributes.Hidden) <> FileAttributes.Hidden And currentFileInfo.Extension <> [Ô].gz[Ô] Then
Using outFile As FileStream = File.Create(currentFileInfo.FullName + [Ô].gz[Ô])
Using Compress As GZipStream = New GZipStream(outFile, CompressionMode.Compress)
[ô]da erro bem aki nesta linha
inFile.CopyTo(Compress)
Console.WriteLine([Ô]Compressed {0} from {1} to {2} bytes.[Ô], currentFileInfo.Name, currentFileInfo.Length.ToString(), outFile.Length.ToString())
End Using
End Using
End If
End Using
End Sub
End Module
queria usar esta funcao mas esta dando erro, alguem pode me ajudar ?
Imports System.IO.Compression
Module MTeste
Sub Main()
Dim zipDirPath As String = [Ô]C:\filesToZip[Ô]
Dim DirInfo As DirectoryInfo = New DirectoryInfo(zipDirPath)
For Each currentFileInfo As FileInfo In DirInfo.GetFiles()
Compress(currentFileInfo)
Next
End Sub
Private Sub Compress(ByVal currentFileInfo As FileInfo)
Using inFile As FileStream = currentFileInfo.OpenRead()
If (File.GetAttributes(currentFileInfo.FullName) And FileAttributes.Hidden) <> FileAttributes.Hidden And currentFileInfo.Extension <> [Ô].gz[Ô] Then
Using outFile As FileStream = File.Create(currentFileInfo.FullName + [Ô].gz[Ô])
Using Compress As GZipStream = New GZipStream(outFile, CompressionMode.Compress)
[ô]da erro bem aki nesta linha
inFile.CopyTo(Compress)
Console.WriteLine([Ô]Compressed {0} from {1} to {2} bytes.[Ô], currentFileInfo.Name, currentFileInfo.Length.ToString(), outFile.Length.ToString())
End Using
End Using
End If
End Using
End Sub
End Module
queria usar esta funcao mas esta dando erro, alguem pode me ajudar ?
Citação:queria usar esta funcao mas esta dando erro, alguem pode me ajudar ?
Tá... está dando um erro... E qual o erro?
Tópico encerrado , respostas não são mais permitidas