Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
TempDir Zip PropertyDelphi example code to open a Zip archive, append a single file, and rewrite the .zip. // Important information about the TempDir property.
{
When the Chilkat Zip component writes a .zip file, it first
writes a temporary .zip to the directory specified by the
Zip.TempDir property. The default value of TempDir is ".", which
is the current working directory of the calling process.
You should ensure that the calling process has permissions
to create and/or write files in the TempDir.
The TempDir is used to safeguard existing .zip files when
rewriting. The WriteZip and WriteZipAndClose methods write
to a temporary .zip first, and if successful, renames it to
the intended destination. This ensures that existing .zip are not
lost if the WriteZip method fails, or is aborted by the application.
}
procedure TForm1.Button6Click(Sender: TObject);
var
recurse: Integer;
success: Integer;
begin
// UnlockComponent should be called once at the beginning of a program.
ChilkatZip21.UnlockComponent('anything for 30-day trial');
// Initialize the zip object.
ChilkatZip21.NewZip('test.zip');
// Add files...
recurse := 1;
ChilkatZip21.AppendFiles('c:/temp/abc/*', recurse);
// Use c:\temp as our TempDir.
ChilkatZip21.TempDir := 'c:\temp';
success := ChilkatZip21.WriteZipAndClose();
if (success = 0) then begin
ChilkatZip21.SaveLastError('zipErrorLog.txt');
ShowMessage(ChilkatZip21.LastErrorText);
end;
ShowMessage('Done!');
end;
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.