|
|
|
|
The following example shows how to handle the archive file:
with Archiver do
begin
FileName := 'C:\TEST\test.zip';
// Create a new archive file
OpenArchive(fmCreate);
// Let's encrypt all files
Password := 'The password';
// Set path to folder with some text files to BaseDir
BaseDir := 'C:\SOURCE_FOLDER';
// Do not compress MPEG3 files
NoCompressionMasks.Text := '*.mp3';
// 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 BaseDir
ExtractFiles('*.*');
// Use full path
Options.StorePath := spFullPath;
// Move all text files from 'C:\SOURCE_FOLDER1' to the archive
MoveFiles('C:\SOURCE_FOLDER1\*.txt',faAnyFile-faDirectory);
// Set path to C:\
BaseDir := 'C:\';
// Overwrite all files
Options.OverwriteMode := omAlways;
// Update all files excluding 1???.t* from 'C:\SOURCE_FOLDER1'
UpdateFiles('SOURCE_FOLDER1\*.*',faAnyFile-faDirectory,'1???.t*');
// Set temporary directory
TempDir := 'C:\TEMP';
// Test all files and directories in the archive
try
TestFiles('*.*');
except
MessageDlg('Errors occurred in the archive file',mtError,[mbOk],0);
end;
// Close the archive
CloseArchive;
end;
|
|