This is a migrated thread and some comments may be shown as answers.

Adding Directories to an Archive

1 Answer 98 Views
ZipLibrary
This is a migrated thread and some comments may be shown as answers.
Xavier Hutchinson
Top achievements
Rank 2
Xavier Hutchinson asked on 28 Sep 2011, 12:35 AM
Hello,

I am having a lot of success with this new addition to the Telerik WPF library, however i cannot see how I can add a directory to the archive?
Thanks,

Xavier.

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 30 Sep 2011, 03:03 PM
Hi Xavier Hutchinson,

When you have a list of files to archive, you can place them in a directory by setting an appropriate file name for them in the archive:
foreach (DataItem file in selectedFiles)
{
    MemoryStream stream = CreateNewFile(file);
    zipPackage.AddStream("New Folder\\" + file.FileName, stream);
}
Setting such a fileName - indicating a path will create a directory named New Folder and will place the archived files in it.

Can you please have a look at the attached solution and let me know if it works for you or if we cna further assist you.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ZipLibrary
Asked by
Xavier Hutchinson
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
Share this question
or