Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Find First Matching Entry in ZipDemonstrates the zip.FirstMatchingEntry method. {
Demonstrates how to use zip.FirstMatchingEntry to locate
a specific file within a zip.
For this example, our .zip contains these entries:
dudeA.gif
setup.exe
b\
b\dudeAbc.gif
b\dudeXyz.gif
b\Setup.exe
b\123\
b\123\dude123.gif
b\123\test.txt
NOTE: Your program may use forward or backward slashes. It makes
no difference in any of the zip component's methods or properties.
}
procedure TForm1.Button8Click(Sender: TObject);
var
i : Integer;
success : Integer;
entry: IChilkatZipEntry2;
begin
ChilkatZip21.UnlockComponent('anything for 30-day trial');
// Open a zip.
success := ChilkatZip21.OpenZip('test.zip');
if (success = 0) then
begin
ChilkatZip21.SaveLastError('zipErrorLog.txt');
ShowMessage(ChilkatZip21.LastErrorText);
end
else
begin
Memo1.Lines.Clear();
// The first entry matching "*.exe" is "setup.exe"
entry := ChilkatZip21.FirstMatchingEntry('*.exe');
Memo1.Lines.Add(entry.FileName);
// The first matching entry of "S*.exe" is "setup.exe"
// because the matching is case insensitive.
entry := ChilkatZip21.FirstMatchingEntry('S*.exe');
Memo1.Lines.Add(entry.FileName);
// The first matching entry of "b\*.gif" is b\dudeAbc.gif
entry := ChilkatZip21.FirstMatchingEntry('b*.gif');
Memo1.Lines.Add(entry.FileName);
end;
end;
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.