-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
I'm using a PowerShell script to download and extract an archive. It's a .tar.bz2 and when I use Expand-7Zip for the first time, it only decompresses it, leaving a .tar file. But when I try to extract it, I get an error message saying it's an invalid package. That is weird because when I double-click on it, 7Zip GUI opens it normally 🤔. This is the whole script:
$ErrorActionPreference = "Stop"
function Expand-Tar($TarFile, $Destination) {
if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) {
Install-Package -Scope CurrentUser -Force 7Zip4PowerShell > $null
}
Expand-7Zip $TarFile $Destination
}
Write-Output "Downloading libraries..."
Invoke-WebRequest http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 -OutFile libs.tar.bz2
New-Item -ItemType directory -Name libs
Write-Output "Exctracting..."
Expand-Tar -TarFile libs.tar.bz2
Expand-Tar -TarFile libs.tar -Destination libs
Remove-Item libs.tar.bz2
Write-Output "Libs have been extracted to the libs/ directory. Copy files for your platform to the debug folder."And this is the error:
Expand-7Zip : Invalid archive: open/read error! Is it encrypted and a wrong password was provided?
If your archive is an exotic one, it is possible that SevenZipSharp has no signature for its format and thus decided it is TAR by mistake.
At C:\Users\Michal Grňo\Documents\GitHub\mff-totem\getlibs.ps1:14 char:5
+ Expand-7Zip $TarFile $Destination
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (SevenZip4PowerS...ip+ExpandWorker:ExpandWorker) [Expand-7Zip], SevenZipArchiveException
+ FullyQualifiedErrorId : err01,SevenZip4PowerShell.Expand7Zip
As I said, extracting with GUI (v18.01) works fine...
Metadata
Metadata
Assignees
Labels
No labels