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.