Skip to main content

CLI frontend for unified file extraction on UNIX systems.

Project description

https://img.shields.io/pypi/v/arc_file_extractor.svg Documentation Status

A unified CLI for file extraction and compression on UNIX systems.

Features

  • Simple extraction: Extract files with a single command arc x file

  • Easy compression: Compress files and directories with arc c source

  • Multiple formats: Support for ZIP, TAR, GZIP, BZIP2, XZ, 7Z, and RAR formats

  • Dependency checking: Built-in tool to check system dependencies

  • Rich output: Beautiful colored output with file sizes and progress

  • Cross-platform: Works on any UNIX-like system (Linux, macOS, BSD)

Installation

Install Arc File Extractor using pip:

pip install arc-file-extractor

Or install from source:

git clone https://github.com/alves/arc_file_extractor.git
cd arc_file_extractor
pip install .

Usage

Basic Commands

Extract a file:

arc x archive.zip
arc x document.tar.gz
arc x backup.7z

This will extract the file to a directory with the same name (without extension).

Compress a file or directory:

arc c myfile.txt
arc c mydirectory/
arc c source/ -o backup.tar.gz

If no output file is specified, it defaults to creating a .zip file.

List supported formats:

arc list

Check system dependencies:

arc check

Advanced Usage

Verbose output:

arc x archive.zip -v
arc c mydir/ -v

Custom output file:

arc c myproject/ -o backup.tar.gz
arc c documents/ -o docs_backup.7z

Supported Formats

Extraction: - ZIP (.zip) - TAR (.tar, .tar.gz, .tgz, .tar.bz2, .tbz, .tar.xz, .txz) - GZIP (.gz) - BZIP2 (.bz2) - XZ (.xz) - 7-Zip (.7z) - RAR (.rar)

Compression: - ZIP (.zip) - TAR (.tar, .tar.gz, .tgz, .tar.bz2, .tbz, .tar.xz, .txz) - 7-Zip (.7z) - RAR (.rar)

Dependencies

Arc File Extractor uses system tools for compression and extraction. Install the required tools:

Ubuntu/Debian:

sudo apt install unzip tar gzip bzip2 xz-utils p7zip-full unrar zip

Fedora/RHEL:

sudo dnf install unzip tar gzip bzip2 xz p7zip unrar zip

Arch Linux:

sudo pacman -S unzip tar gzip bzip2 xz p7zip unrar zip

macOS:

brew install p7zip unrar zip

Examples

Extract various archive types:

# Extract a ZIP file
arc x project.zip
# Creates: project/ directory

# Extract a TAR.GZ file
arc x backup.tar.gz
# Creates: backup/ directory

# Extract with verbose output
arc x large_archive.7z -v

Compress files and directories:

# Compress a directory to ZIP (default)
arc c myproject/
# Creates: myproject.zip

# Compress to TAR.GZ
arc c documents/ -o docs.tar.gz

# Compress a single file
arc c important_file.txt -o compressed.7z

Check system status:

# Check what tools are installed
arc check

# List all supported formats
arc list

Development

To set up for development:

git clone https://github.com/alves/arc_file_extractor.git
cd arc_file_extractor
pip install -e .[dev]

Run tests:

pytest

API Reference

Core Classes

ArcFileExtractor

Main class for file extraction and compression operations.

from arc_file_extractor import ArcFileExtractor

extractor = ArcFileExtractor()

# Extract a file
result = extractor.extract("archive.zip")

# Compress a file/directory
result = extractor.compress("source_dir", "output.tar.gz")

Methods:

  • extract(file_path: str) -> int: Extract a file to a directory with the same name

  • compress(source_path: str, output_file: str = None) -> int: Compress a file or directory

Utility Functions

check_dependencies() -> List[str]

Check if required external tools are installed. Returns a list of missing dependencies.

get_supported_formats() -> dict

Get supported file formats for extraction and compression.

validate_file_path(file_path: str) -> bool

Validate if a file path exists and is readable.

get_file_size(file_path: str) -> str

Get human-readable file size.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests for new functionality

  5. Run the test suite

  6. Submit a pull request

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arc_file_extractor-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arc_file_extractor-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file arc_file_extractor-0.1.0.tar.gz.

File metadata

  • Download URL: arc_file_extractor-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for arc_file_extractor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aff6ca36ab54b05ffc85355f7d71ea0f536f36a80caa024c28b5cbcab6b27770
MD5 53b713f9c396d5fd52759151cbf10886
BLAKE2b-256 74bb73e80b8abb02d84f724123f59f1e4b0a72e2f717994f8342190f8960ea29

See more details on using hashes here.

File details

Details for the file arc_file_extractor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for arc_file_extractor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51695b896d7cbff3605def812f6f72f88fa28f7efd7f4df478d6c90e2ec399ca
MD5 19af6c7ed2c988f4a54194562c377547
BLAKE2b-256 4fdec3936524ccb7a62812ee6b774bedcd9af21ef6d7a62c9e9268522774a04d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page