Using SharpZipLib, I'm adding files to a existing zip file:
using (ZipFile zf = new ZipFile(zipFile)) {
zf.BeginUpdate();
foreach (FileInfo fileInfo in fileInfos) {
string name = fileInfo.FullName.Substring(rootDirectory.Length);
FileAttributes attributes = fileInfo.Attributes;
if (clearArchiveAttribute) attributes &= ~FileAttributes.Archive;
zf.Add(fileInfo.FullName, name);
//TODO: Modify file attribute?
}
zf.CommitUpdate();
zf.Close();
}
Now the task is to clear the Archive
file attribute.
But unfortunately, I figured out that this is only possible when creating a new zip file using ZipOutputStream
and set ExternalFileAttributes
:
// ...
ZipEntry entry = new ZipEntry(name);
entry.ExternalFileAttributes = (int)attributes;
// ...
Is there a way to add files and modify file attributes?
Is this possible with DotNetZip?