Compress Zip File Logo

Compress Zip File

CompressZipFile Team
9 min read

How to Extract Specific Files from a ZIP (Windows, Mac, Linux)

Learn how to selectively extract specific files from a ZIP archive on Windows, Mac, and Linux without decompressing the entire folder. Save time and disk space!

📦
How to Extract Specific

If you have ever downloaded a massive 5GB ZIP file only to realize you just needed a single 2MB document inside it, you know how frustrating it is to decompress the entire archive. Extracting everything wastes storage space, consumes unnecessary processing power, and takes up your valuable time.

Fortunately, modern operating systems and online tools support selective extraction—allowing you to extract specific files from a ZIP without unzipping the entire package.

In this guide, we'll show you exactly how to perform a partial ZIP extraction on Windows, Mac, Linux, and directly in your browser. If you are looking for a broader overview, check out our full guide to unzipping files.

Why Extract Only Specific Files?

Instead of fully unpacking an archive, selective extraction offers three distinct advantages:

  1. Massive Time Savings: If an archive contains 10,000 files, the operating system must read and write every single file to your disk during a full extraction. When you extract just one file, the process takes milliseconds.
  2. Conserves Disk Space: Decompressing a 10GB ZIP file requires at least 10GB of free space on your hard drive. Selective extraction bypasses this storage requirement completely.
  3. Improves Efficiency: It keeps your folders clean. You avoid cluttering your "Downloads" directory with hundreds of unneeded assets.

Technically speaking, this is possible because of the way ZIP files are built. If you understand ZIP file internal structure, you'll know that every ZIP archive contains a Central Directory at the end of the file. This directory acts as an index. The software simply reads the index, jumps directly to the location of your requested file, and decompresses just that specific chunk of data.

Diagram showing how selective extraction bypasses the rest of the ZIP file

Selective Extraction Online

The absolute fastest way to pull one file out of an archive is by using an online extractor. You don't need to install external software, and you can visually select exactly what you want to download.

With CompressZipFile's online tool, you can securely preview ZIP contents before extraction right in your web browser.

How to extract specific files online:

  1. Go to the CompressZipFile tool to extract files from your ZIP.
  2. Drag and drop your ZIP file into the browser window.
  3. The tool will instantly parse the archive and display a file tree showing every folder and document inside.
  4. Browse through the folders and check the box next to the specific file(s) you want.
  5. Click Extract Selected, and only those files will be downloaded to your computer.

All processing happens locally in your browser. Your files are never uploaded to a remote server, ensuring complete privacy.

Method Comparison for Selective Extraction

MethodBest ForTechnical Knowledge RequiredExtracts Entire Archive First?
Online (CompressZipFile)Quick browser accessLowNo
Windows ExplorerBasic users on PCLowNo (background processing)
PowerShell (.NET)Automation scriptsHighNo
Mac Terminal (unzip)Developers, Linux usersMediumNo
Mac GUI (Default)Standard Mac usersLowYes (Extracts all)

How to Extract Specific Files on Windows

If you prefer using native Windows tools, you can easily extract individual files using File Explorer or PowerShell.

Method 1: Using Windows File Explorer (Drag-and-Drop)

Windows natively treats ZIP files like regular folders.

  1. Double-click your ZIP archive. It will open like a normal folder.
  2. Navigate through the internal folders to find the specific file you want.
  3. Click and drag the file out of the ZIP window and drop it onto your Desktop or into another folder.
  4. Windows will instantly decompress just that file in the background.

Method 2: Selective Extraction using PowerShell (.NET Method)

PowerShell's default Expand-Archive command does not support selective extraction—it forces you to unzip everything. However, you can use the built-in .NET System.IO.Compression library for targeted extraction.

Here is the script to extract a single file (report.pdf) from an archive:

# Load the .NET assembly for ZIP files
Add-Type -AssemblyName System.IO.Compression.FileSystem

$zipPath = "C:\Downloads\archive.zip"
$destination = "C:\Downloads\report.pdf"
$fileToExtract = "documents/report.pdf" # Path inside the ZIP

# Open the ZIP and search for the file
$zip = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
$entry = $zip.Entries | Where-Object { $_.FullName -eq $fileToExtract }

if ($entry) {
    [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $destination, $true)
    Write-Host "File successfully extracted!"
} else {
    Write-Host "File not found in the archive."
}

$zip.Dispose()

How to Extract Specific Files on Mac & Linux

Unix-based systems like macOS and Linux use the powerful unzip command-line utility, which perfectly supports extracting individual files natively.

Method 1: macOS Finder (GUI)

Unlike Windows, double-clicking a ZIP file on a Mac will automatically extract the entire archive. If you want to extract a specific file via GUI, you usually need a third-party app like The Unarchiver.

Method 2: The Terminal (Mac & Linux)

To avoid extracting the whole file, open your Terminal and use the unzip command.

The basic syntax is:

unzip archive.zip "filename.txt"

If the file is inside a folder within the ZIP, you must include the full internal path:

unzip archive.zip "documents/reports/2026_financials.pdf"

To extract multiple specific files at once, simply list them separated by spaces:

unzip archive.zip "file1.png" "file2.png" "folder/file3.txt"

Extract Files by Type, Size, or Date

Sometimes, you don't know the exact name of the file you need, but you know you only want the PDFs or the JPEGs. You can use wildcard matching for this.

Using Wildcards in Terminal

If you want to extract all PDF files from a ZIP while ignoring the images and documents, use an asterisk (*):

unzip archive.zip "*.pdf"

(Note: Always wrap the wildcard in quotes so the shell doesn't interpret it before passing it to unzip!)

If you are dealing with a massive data dump and need to unzip multiple ZIP files together just to grab the CSV files, a quick bash loop combined with the wildcard command can save you hours of manual work.

Advanced Filtering (Grep)

On Linux, you can combine unzip -l (which lists contents) with grep to find files created on a specific date, and then pipe that into an extraction command.

unzip -l archive.zip | grep "2026-06-09" | awk '{print $4}' | xargs unzip archive.zip

This lists the archive, finds files stamped with "2026-06-09", and extracts only those matches.

Next Steps with ZIP Management

Once you've extracted what you need, you might realize the ZIP file itself needs updating. Instead of unzipping the whole thing to make a change, you can easily add or remove files from ZIP archives directly. Managing your archives efficiently requires knowing when to extract, when to append, and when to compress!

FAQ: Selective ZIP Extraction

Q1: Is selective extraction faster than extracting the entire ZIP? Yes, significantly faster. Because the ZIP format includes a central directory map, extraction tools jump straight to the exact byte location of your targeted file and ignore the rest. Extracting a 1MB file from a 50GB archive takes just milliseconds.

Q2: How do you extract a specific file in nested folders? In Windows File Explorer, simply navigate through the nested folders within the ZIP and drag the file out. Via command line, you must provide the exact internal path (e.g., unzip archive.zip "parentFolder/childFolder/target.txt").

Q3: Can you extract multiple specific files from the command line? Yes. You can specify multiple filenames in your command separated by spaces, or you can use wildcards (like *.jpg) to extract all files matching a specific file extension.

Q4: Will the extracted file be exactly the same as the original? Absolutely. ZIP files use lossless DEFLATE compression. When a specific file is extracted, a CRC32 verification check is performed, guaranteeing that the extracted file is a byte-for-byte identical match to the original.