Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Untar a .tar ArchiveUntar a .tar archive.
CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @sTmp0 nvarchar(4000) -- Important: It is helpful to send the contents of the -- tar.LastErrorText property when requesting support. -- Untar a .tar archive. DECLARE @tar int EXEC @hr = sp_OACreate 'Chilkat.Tar', @tar OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- Any string automatically begins the 30-day trial. DECLARE @success int EXEC sp_OAMethod @tar, 'UnlockComponent', @success OUT, 'Anything for 30-day trial' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @tar, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END DECLARE @fileCount int -- Untar into c:/temp/untarDir. The directory tree(s) contained -- within the TAR archive will be re-created rooted at this -- directory. EXEC sp_OASetProperty @tar, 'UntarFromDir', '/Users/chilkat/temp/untarDir' -- If any filepaths within the Tar archive are absolute, -- automatically make them relative by removing the first -- forward or backward slash. This protects from untarring -- files to unexpected locations. EXEC sp_OASetProperty @tar, 'NoAbsolutePaths', 1 EXEC sp_OAMethod @tar, 'Untar', @fileCount OUT, '/Users/chilkat/testData/tar/abc123.tar' IF @fileCount < 0 BEGIN EXEC sp_OAGetProperty @tar, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 END ELSE BEGIN PRINT 'Untarred ' + STR(@fileCount) + ' files and directories' END END GO |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.