PowerBuilder
PowerBuilder
Untar a .tar Archive
See more Tar Archive Examples
Untar a .tar archive.Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Tar
integer li_FileCount
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// Untar a .tar archive.
loo_Tar = create oleobject
li_rc = loo_Tar.ConnectToNewObject("Chilkat.Tar")
if li_rc < 0 then
destroy loo_Tar
MessageBox("Error","Connecting to COM object failed")
return
end if
// Untar into c:/temp/untarDir. The directory tree(s) contained
// within the TAR archive will be re-created rooted at this
// directory.
loo_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.
loo_Tar.NoAbsolutePaths = 1
li_FileCount = loo_Tar.Untar("/Users/chilkat/testData/tar/abc123.tar")
if li_FileCount < 0 then
Write-Debug loo_Tar.LastErrorText
else
Write-Debug "Untarred " + string(li_FileCount) + " files and directories"
end if
destroy loo_Tar