Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Strange 0, 1 og 2 rootfolder in zip-file

$
0
0

The ZIP-files that are created using Rebex ZIP contains a rootfolder by the name 0, 1 or 2.

Why is this rootfolder created and how can it be avoided?

I use FileSet.

Using archive As New ZipArchive(Path.Combine(sProjectPath, project.GetZipName), Rebex.IO.Compression.ArchiveOpenMode.CreateNew)
    Dim fileSet As New Rebex.IO.FileSet(project.LocalPath)
    For Each include As String In project.Includes
        fileSet.Include(include, TraversalMode.MatchFilesDeep)
    Next
    For Each exclude As String In project.Excludes
        fileSet.Exclude(exclude)
    Next
    Dim result As ArchiveOperationResult = archive.Add(fileSet, TraversalMode.MatchFilesShallow, TransferMethod.Copy, ActionOnExistingFiles.OverwriteAll)
End Using

My project class looks like this

Public Class Project

    <XmlElement(ElementName:="type")>
    Public Property Type() As String

    <XmlElement(ElementName:="name")>
    Public Property Name() As String

    <XmlElement(ElementName:="localpath")>
    Public Property LocalPath() As String

    <XmlElement(ElementName:="subdirs")>
    Public Property SubDirs() As Boolean

    <XmlArray("includes"),
        XmlArrayItem(GetType(String), ElementName:="include")
        >
    Public Includes As New List(Of String)

    <XmlArray("excludes"),
        XmlArrayItem(GetType(String), ElementName:="exclude")
        >
    Public Excludes As New List(Of String)


    <XmlElement(ElementName:="enabled")>
    Public Property Enabled() As Boolean

    Public Function GetZipName() As String
        Return Me.Type().Replace("", "_") + "_" + Me.Name().Replace("", "_") + "_" + Date.Now.ToString("yyyyMMddHHmmss") + ".zip"
    End Function

End Class

The created zip file can be seen here:
https://drive.google.com/file/d/0Bxz1qoeLYqrwekVtcGd3NFhpQVE/view?usp=sharing


Viewing all articles
Browse latest Browse all 3862

Trending Articles