SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Archieving Files and Directories

Last post 08-21-2008 9:58 PM by JohnReilly. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-07-2008 11:52 PM

    Archieving Files and Directories

    I am trying to create an archieve which consists of all folders and files inside those folders.

    The folder structure is
    c:\Temp has a Subdirectory "Test" which has a file called "Temp1.xml".

    In my code i do the following
                string path = @"C:\Temp\Test.zip";
                ZipFile zipFile = ZipFile.Create(path);

                using (zipFile)
                {
                    zipFile.BeginUpdate();               
                    zipFile.AddDirectory(@"\Test");
                    zipFile.Add(@"c:\Temp\Test\Temp1.xml");
                    zipFile.CommitUpdate();
                }

    When i open the file in WinZip the Path shown for the file is "Temp\Test". This is correct as per the code above.

    However i wish to archieve the file so that the path for the file in WinZip is "\Test" that is begining at the subfolder and not at the Root. If i do the following in my source code

                string path = @"C:\Temp\Test.zip";
                ZipFile zipFile = ZipFile.Create(path);

                using (zipFile)
                {
                    zipFile.BeginUpdate();               
                    zipFile.AddDirectory(@"\Test");
                    zipFile.Add(@"\Test\Temp1.xml");
                    zipFile.CommitUpdate();
                }

    The archieve is corrupted.

    Any clues as to how this can be achieved.

     Thanks a lot.

  • 08-21-2008 9:58 PM In reply to

    Re: Archieving Files and Directories

     Hi,

    A clue: Have a look at EntryFactory or NameTransform which is a part of the entry factory.

     

    Cheers,

    -jr-

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.