【问题标题】:Unzip nested zip files with powershell使用 powershell 解压缩嵌套的 zip 文件
【发布时间】:2021-05-29 05:31:10
【问题描述】:

我有以下结构 文件夹\zip\zip1、zip2、zip3

我想将 zip1、zip2、zip3 中包含的所有文件提取到一个文件夹中。

我尝试使用 Expand-Archive,但无法超出 zip 文件夹。

【问题讨论】:

    标签: powershell zip unzip


    【解决方案1】:

    如果结构如下所示:

    /Folder/
      /Foo.zip
        /1.zip
        /2.zip
    

    那么最简单的方法就是:

    Expand-Archive -LiteralPath 'c:\folder\Foo.zip' -DestinationPath 'C:\temp\Foo-expanded\'
    
    # Get all the nested zip files, and expand them to the same folder:
    Get-ChildItem 'C:\folder\expanded\*.zip' | 
      Expand-Archive -DestinationPath 'C:\folder\SingleFolder\'
    

    如果要覆盖现有文件,请使用 Expand-Archive -Force

    【讨论】:

      猜你喜欢
      • 2017-05-24
      • 1970-01-01
      • 2020-11-30
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 1970-01-01
      • 2021-10-08
      相关资源
      最近更新 更多