Modify archive
Adds, replaces and deletes files in an existing 7z archive
- Parameters
- Advanced call ?
Function ModifyArchive(Val Archive, Val AddableFiles = Undefined, Val DeletablePaths = Undefined, Val Settings = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Archive | --src | String, BinaryData | ✔ | Path to the archive on disk or binary data |
| AddableFiles | --additions | Map Of KeyAndValue | ✖ | Key: archive path; value: file path or binary data |
| DeletablePaths | --deletions | Array Of String | ✖ | Paths of files in the archive for deletion |
| Settings | --settings | Map Of KeyAndValue | ✖ | Modification settings. See GetArchiveModificationStructure |
Returns
BinaryData, Map Of KeyAndValue - Result of the operation for the archive on the disk or new binary data of the archive
| Parameter | Description |
|---|---|
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
Parameters with Binary data type can also accept file paths on disk and URLs
1C:Enterprise/OneScript code example
ArchivePath = Parameters["SevenZ_ArchivePath"];
NewFilePath = Parameters["SevenZ_NewFilePath"];
AddableFiles = New Map;
AddableFiles.Insert("extra/info.txt", NewFilePath);
AddableFiles.Insert("readme.txt" , GetBinaryDataFromString("Replaced readme content", "UTF-8"));
DeletablePaths = New Array;
DeletablePaths.Add("config/settings.json");
DeletablePaths.Add("missing/path.txt");
Result = OPI_7z.ModifyArchive(ArchivePath, AddableFiles, DeletablePaths);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint 7z ModifyArchive \
--src "/tmp//opi_sevenz_63920079973933/archive_buffer.7z" \
--additions "{'extra/info.txt':'/tmp//opi_sevenz_63920079973933/extra_info.txt','readme.txt':'/tmp/0pu3uq4c.pcr'}" \
--deletions "['config/settings.json','missing/path.txt']"
:: JSON data can also be passed as a path to a .json file
oint 7z ModifyArchive ^
--src "/tmp//opi_sevenz_63920079973933/archive_buffer.7z" ^
--additions "{'extra/info.txt':'/tmp//opi_sevenz_63920079973933/extra_info.txt','readme.txt':'/tmp/0pu3uq4c.pcr'}" ^
--deletions "['config/settings.json','missing/path.txt']"
Result
{
"result": true
}