I'm trying to pack a folder directory into a zip directory, not including all child folders.
currently i m using this method to pack the whole directory.
public void directoryPacker(DirectoryInfo directoryInfo)
{
string pathToRootDirectory = Path.Combine(directoryInfo.Parent.FullName,
directoryInfo.Name) + ".abc"; //name of root file
using(ZipContainer zip = new ZipContainer(pass))
//ZipContainer inherits from Ionic.Zip.ZipFile
{
//some password stuff here
//
//zipping
zip.AddDirectory(directoryInfo.FullName, "/"); //add complete subdirectory to *.abc archive (zip archive)
File.Delete(pathToRootDirectory);
zip.Save(pathToRootDirecotry); //save in rootname.bdd
}
}
this works really great, but now i have a
List<string> paths
within the paths to the childfolders which i want to have in my zipArchive. The other childfolders(not in the list) should not be in the archive
thank you
I couldn't find any built in function that adds folder non-recursively. So I wrote a function that adds them manually:
I did not test it, can you tell me if this works for you?