Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET individual files for zipping

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

    I would like to create a list of selected files in several different folders and zip those files (with paths) to a zip file. I’m using VB.NET.

    The only reference or examples I’ve found is with “filters”. Is this the only or best method? I’m hoping there is a way to create an array of file names (these are very specific and a long list).

    Thanks for your help.

    Imported from legacy forums. Posted by PaulG (had 2406 views)

    User (Old forums)
    Member
    Post count: 23064

    The best way to accomplish this is to use your array of file names (including full path) and, in a loop, make a DiskFile of each one, and then use the CopyTo() method to copy them to the zip archive. Do this loop within a Begin/EndUpdate section, so the zip file is created only once. If you want to keep paths, then you need to use ZippedFolder instead of ZipArchive. This will create the desired folder into the zip file, to which you can CopyTo the file you want.

    Imported from legacy forums. Posted by André (had 3010 views)

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