Archive Decompression with PowerShell RRS feed

  • General discussion

  • Gents, I am working with DMARC Aggregate reports.  For those unfamiliar, these reports come from remote mail domains in a compressed archive, sometimes as .zip and other times as .gz.  I've come up with a script that will do the work for me.  This is actually just a small part of a larger script that prepares the reports for ingest into ElasticStack.

    Anyways, I am just looking for another set of eyes that are more capable than my own of looking at my work and identifying any areas that could be written better.  My PowerShell skills are more akin to an ogre with a club than a surgeon with a scalpel.

    Install-Package 7Zip4Powershell -Force
    $ARoot = Read-Host "Specify folder containing archives"
    $ARepo = Get-Childitem $ARoot | Select Name
    $FDst = Read-Host "Specify path to decompress files to"
    foreach ($AFile in $ARepo) {
    $AName = $AFile | Select -ExpandProperty Name
    Expand-7zip -Verbose $ARoot\$AName -TargetPath $FDst
    $NameCheck = Get-Childitem $FDst | Where-Object {$_.Name -like "*.tar"}
    foreach ($Name in $NameCheck) {
    $Name | Rename-Item -NewName { [io.path]::ChangeExtension($_.name, "") }

    • Changed type Bill_Stewart Monday, March 19, 2018 5:47 PM
    • Moved by Bill_Stewart Monday, March 19, 2018 5:47 PM This is not a support forum for third-party modules
    Sunday, February 18, 2018 9:54 PM

All replies

  • What's your question/problem?

    We didn't write the "7Zip4Powershell" package. If you have questions about it, ask the author.

    -- Bill Stewart [Bill_Stewart]

    Monday, February 19, 2018 3:56 PM