The following example shows how to add files to archive and extract them:
with Archiver do
begin
FileName := 'C:\TEST\test.zip';
// Create a new archive file
OpenArchive(fmCreate);
// Set path to folder with some text files to BaseDir
BaseDir := 'C:\SOURCE_FOLDER';
// Add all files and directories from 'C:\SOURCE_FOLDER' to the archive
AddFiles('*.*');
// Set path to destination folder
BaseDir := 'C:\DESTINATION_FOLDER';
// Extract all files and directories from the archive to 'C:\DESTINATION_FOLDER'
ExtractFiles('*.*');
// Close the archive
CloseArchive;
end;
|
|