Archive Tool

Extract, create, and list archive files (zip, tar, gz natively; rar, 7z with system tools) using batch or single operations with optional passwords.

Audits

Pending

Install

openclaw skills install archive-tool

Archive Tool

Extract and create archive files (zip, rar, 7z, tar, gz).

When This Skill Activates

This skill triggers when user wants to extract, create, or list archive files.

Reasoning Framework

StepActionWhy
1DETECTIdentify archive format (zip/tar/gz/rar/7z)
2CHECKVerify tools available for format
3EXECUTEExtract, create, or list
4VERIFYConfirm success, report errors

Install

# Optional (for rar/7z support)
brew install unar p7zip

Decision Tree

What are you trying to do?

├── Extract archive
│   └── Use: archive.py extract file.zip -o ./output
│
├── Create archive
│   └── Use: archive.py create output.zip ./folder
│
├── View contents
│   └── Use: archive.py list file.zip
│
└── Batch extract
    └── Use: archive.py extract "*.zip"

Features

FeatureDescription
Extractzip, tar, tar.gz, tgz, gz, rar, 7z
Createzip, tar, tar.gz
ListView archive contents
BatchExtract multiple files

Extract

Command

python archive.py extract <file> [-o OUTPUT] [--password PASS]

Examples

# Extract to current folder
python archive.py extract archive.zip

# Extract to specific folder
python archive.py extract archive.zip -o ./extracted

# Extract with password
python archive.py extract archive.rar --password secret

# Extract to current directory
python archive.py extract archive.7z -o ./

# Batch extract all zip files
python archive.py extract "*.zip"

Create

Command

python archive.py create <output> <source> [--compression LEVEL]

Examples

# Create zip from folder
python archive.py create myfiles.zip ./myfolder

# Create tar from folder
python archive.py create backup.tar ./folder

# Create tar.gz
python archive.py create backup.tar.gz ./folder

List

Command

python archive.py list <file>

Examples

# List contents
python archive.py list archive.zip

# View without extracting
python archive.py list backup.tar.gz

Supported Formats

FormatExtractCreateNotes
zipPython stdlib
tarPython stdlib
tar.gz / tgzPython stdlib
gzPython stdlib
rar⚠️Requires unar
7z⚠️Requires p7zip

⚠️ = requires system tools


Options

FlagDescriptionDefault
-o, --outputOutput directorycurrent dir
--passwordArchive passwordnone
--compression0-9 (zip only)6

Troubleshooting

Problem: "No module named 'zipfile'"

  • Cause: Using Python 2
  • Fix: Use python3 instead of python

Problem: "Unsupported archive format"

  • Cause: Unknown format or corrupted file
  • Fix: Verify file extension is correct

Problem: "Password required"

  • Cause: Encrypted archive
  • Fix: Use --password flag

Problem: "rar/7z extraction failed"

  • Cause: Tools not installed
  • Fix: brew install unar p7zip

Problem: "Permission denied"

  • Cause: No write permission in output folder
  • Fix: Check folder permissions or use different output path

Self-Check

  • Using correct Python (python3)
  • Archive file exists and is readable
  • For rar/7z: required tools installed
  • Output directory exists and is writable
  • Password correct (if encrypted)

Quick Reference

TaskCommand
Extract zippython archive.py extract file.zip
Extract to folderpython archive.py extract file.zip -o ./out
Extract rarpython archive.py extract file.rar
Create zippython archive.py create out.zip ./folder
Create tar.gzpython archive.py create out.tar.gz ./folder
List contentspython archive.py list file.zip