【问题标题】:PowerShell - extract contents of a specific folder recursivelyPowerShell - 递归提取特定文件夹的内容
【发布时间】:2020-05-07 11:11:16
【问题描述】:

我想使用 powershell 从 zip 文件中提取文件夹的内容到不同的位置。

  • 压缩文件:archive.zip
  • zip 中的路径:mypath(文件夹包含多个文件和子文件夹)
  • 目的地:c:\destination

如果我正常提取,我会创建文件夹:

  • 命令:Expand-Archive -Path archive.zip -DestinationPath c:\destination
  • 已创建文件夹:c:\destination\mypath

我想直接把文件夹的内容解压到c:\destination中。

【问题讨论】:

    标签: powershell powershell-3.0 powershell-4.0


    【解决方案1】:

    如果它是 OP 中提到的值的特定要求,那么这应该可以工作

    $Path='c:\temp\destination';Expand-Archive archive.zip $Path;Move-Item $Path\mypath\* $Path;rm $Path\mypath;
    

    【讨论】:

      猜你喜欢
      • 2014-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-31
      • 2014-03-02
      • 2017-09-28
      • 2012-11-19
      相关资源
      最近更新 更多