如何解压缩文件夹和子文件夹中的所有.zip文件?

时间:2019-04-10 01:31:48

标签: python zip

我有一个大文件夹/myfolder/,其中包含许多不同的子文件夹,例如:

  • /myfolder/aa/
  • /myfolder/ab/
  • /myfolder/ac/
  • /myfolder/ad/

,每个子文件夹包含许多zip文件。我想直接将它们全部解压缩到myfolder中(即在同一位置)

如何在Python中做到这一点? 谢谢!

2 个答案:

答案 0 :(得分:1)

这可以在python中完成,但是bash脚本可能更理想。

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.col-container {
  
 
 
}
.col1 {
  float:left;
  padding: 16px;
  width:250px;
 height:400px;
  overflow: scroll;
  background:red;
  
}
.col2 {

 float:left;
  padding: 16px;
  width:250px;
  height:400px;
  overflow: scroll;
  background:yellow;
   
}
</style>
</head>
<body>


<h2>Sample page</h2>


<div class="col-container">
  <div class="col1">
    <h2>Navigation</h2>
   <ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>  
  </div>

  <div class="col2">
    <h2>Content</h2>
    <p>Content Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.
To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme.
Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign.
Reading is easier, too, in the new Reading view. You can collapse parts of the document and focus on the text you want. If you need to stop reading before you reach the end, Word remembers where you left off - even on another device.
</p>
  </div>

  
</div>

</body>
</html>

答案 1 :(得分:0)

如果您多次执行此操作,我认为bash脚本可能比python脚本更好,否则这个问题可能对您有所帮助。

How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line?