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

How to append files to a splitted archive? #205

Open
AlPecin opened this issue Feb 19, 2024 · 0 comments
Open

How to append files to a splitted archive? #205

AlPecin opened this issue Feb 19, 2024 · 0 comments

Comments

@AlPecin
Copy link

AlPecin commented Feb 19, 2024

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?

@AlPecin AlPecin changed the title Howto append files to a splitted archive? How to append files to a splitted archive? Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant