How to extract multi-part zip into same folder in Mac

TLDR;

To extract a multi-part zip file on a Mac:

  1. Open Terminal.
  2. Navigate to the folder with the zip file.
  3. Type unzip ‘*.zip’ -d /path/to/unzip/destination and press Enter.

When downloading a large file from Google Drive, one may receive multiple ZIP files depending on the directory’s size. I had some old projects saved on Google Drive that I wanted to download. I downloaded them and received multiple ZIP files. When I extracted one file, I realized that it did not extract the other files. I then extracted a second ZIP file and extracted it into another file with the “filename2” format. I then copied the files from the “filename2” folder into the “filename” folder. This replaced the entire folder and did not include the files from “filename” this was unfortunate. To circumvent this issue, one can extract all of the files from the ZIP files into a single directory. A straightforward command can be used to extract all files into a single directory without overwriting it.

Step 1: Understanding the Issue

The problem arises when Google Drive doesn’t use numbered file extensions for multipart archives. Instead, it separates the directory into multiple individual zip files. Let’s call them “archive1.zip,” “archive2.zip,” and so on. When you try to unzip each of these files separately, you end up with incomplete data and a mess in your destination folder.

Step 2: Using the Right Command Unzip

To successfully extract the zips, we’ll use the powerful ‘unzip’ command. The ‘unzip’ command has a useful feature that allows us to extract multiple zip files in one go and merge their contents into the same destination folder. Here’s the command you should use:

unzip '*.zip' -d /path/to/unzip/destination

Explanation:

unzip: This is the command used to extract files from a zip archive.

*.zip: The asterisk (*) is a wildcard that matches all files with the “.zip” extension in the current directory.

-d /path/to/unzip/destination: Specifies the destination directory where the contents of all zip files will be extracted.

Make sure to replace /path/to/unzip/destination with the actual path to the folder where you want the contents to be extracted.

Step 3: Executing the Command

Open your terminal or command prompt and navigate to the directory where the downloaded zip files are located. Then, run the ‘unzip’ command mentioned above. You should see the output as each zip file is successfully extracted, and its contents are merged into the destination folder.

Congratulations! You have successfully re-assembled and unzipped a large directory downloaded from Google Drive. By using the ‘unzip’ command with the appropriate wildcard, you were able to avoid the issues caused by multipart archives without numbered file extensions.

Remember, the ‘unzip’ command can be a powerful tool for handling zip archives efficiently. I hope this blog post helps you overcome the issue you encountered and makes your file management tasks a lot easier!

Happy unzipping!

Note: The instructions provided in this blog post assume a Unix-like operating system (e.g., Linux, macOS). If you’re using a Windows system, consider using 7-Zip or other archive management software that supports batch extraction to achieve a similar result.

References: https://superuser.com/questions/1255221/how-to-unzip-multiple-zip-files-into-a-single-directory-structure-e-g-google-d

Leave a Reply

Your email address will not be published. Required fields are marked *