Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

How to append files to a splitted archive? #205

@AlPecin

Description

@AlPecin

When I use this code it works fine:

string ArchiveFile = Path.Combine(Environment.CurrentDirectory, "Archive.7z");

SevenZipCompressor.SetLibraryPath(Path.Combine(Environment.CurrentDirectory, "7z.dll"));
var compressor = new SevenZipCompressor
{
    ArchiveFormat = OutArchiveFormat.SevenZip,
    DirectoryStructure = true,
    PreserveDirectoryRoot = true
   // , VolumeSize = 1000 * 1024 * 10 // 10MB segments
};

// Compress the Files directory
compressor.CompressDirectory(Path.Combine(Environment.CurrentDirectory, "Files"), ArchiveFile);

// Append two files
var modificationList = new List<string>
        {
            Path.Combine(Environment.CurrentDirectory, "EventLog.txt"),
            Path.Combine(Environment.CurrentDirectory, "FileVersions.txt")
        };

compressor.CompressionMode = CompressionMode.Append;
compressor.DirectoryStructure = false;
compressor.PreserveDirectoryRoot = false;

compressor.CompressFiles(ArchiveFile, modificationList.ToArray());

but when I want to get a splitted archive (uncomment the line with VolumeSize) I got a Exception:

Could not pack files! Message: file "...\Archive.7z" does not exist.

What do I have to do to make it work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions