Adding Directories to an Archive

2 posts, 0 answers
  1. Xavier Hutchinson
    Xavier Hutchinson avatar
    23 posts
    Member since:
    Nov 2009

    Posted 27 Sep 2011 Link to this post


    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?

  2. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 30 Sep 2011 Link to this post

    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 >>

Back to Top