Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20101 |

    I am trying to add a folder (and it’s subfolders) into a new specific folder within an existing zip archive created just prior.  Although the documentation sttes that I should use the ZippedFolder technique, I cannot find a good example of how to exactly do this.  Are there any simple examples?  The snippet explorer does not really have anything as direct as this.  I am using VB2008.

    Imported from legacy forums. Posted by Michael (had 2312 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Here’s a quick sample I made to copy a folder into a new zip, create a new subfolder within the zip and then send a 2nd folder into that newly created subfolder :

    [quote]

        ‘ Variables
        Dim diskFolder1 As DiskFolder, diskFolder2 As DiskFolder
        Dim zipArchive As ZipArchive, zipFile As DiskFile, zipFolder As ZippedFolder

        ‘ Init
        zipFile = New DiskFile(“C:\Forums\17647\Tests\Test.zip”)
        If zipFile.Exists Then zipFile.Delete()
        zipFile.Create()
        zipArchive = New ZipArchive(zipFile)

        ‘ Put Folder1 in the zip archive
        Console.WriteLine(“Part 1: zip Folder1 (press Enter)”)
        Console.ReadLine()

        diskFolder1 = New DiskFolder(“C:\Forums\17647\Tests\Folder1”)
        diskFolder1.CopyFilesTo(zipArchive, True, True)

        ‘ Put Folder2 in a new subfolder in the zip archive
        Console.WriteLine(“”)
        Console.WriteLine(“Part 2: zip Folder2 (press Enter)”)
        Console.ReadLine()

        zipFolder = New ZippedFolder(zipFile, “NewFolder”)
        zipFolder.Create()
        diskFolder2 = New DiskFolder(“C:\Forums\17647\Tests\Folder2”)
        diskFolder2.CopyFilesTo(zipFolder, True, True)

        ‘ Done
        Console.WriteLine(“”)
        Console.WriteLine(“Done! (press Enter)”)
        Console.ReadLine()

    [/quote]

    Imported from legacy forums. Posted by Diane [Xceed] (had 3007 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.