Project

dcat

0.0
The project is in a healthy, maintained state
Dcat builds searchable catalogs of directory trees, recording each file's full path, modification date and size as tab-separated text. Catalogs can be gzip-compressed for compact storage and searched with ripgrep. It ships three commands: dcatc to create a catalog, dcats to search catalogs, and dcatz to read compressed catalogs as an alternative to zcat.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

Dcat

English | 日本語

A Ruby gem for creating and searching disk catalogs. Generate searchable catalogs containing file lists and metadata (size, modification date) with efficient gzip compression for storage.

Features

  • Create catalogs from directory structures with file metadata
  • Search catalogs efficiently using ripgrep
  • Compress catalogs with gzip for space-efficient storage
  • Cross-platform support with Windows compatibility
  • Human-readable file sizes in output

Installation

Install the gem by executing:

$ gem install dcat

Or add to your Gemfile:

gem 'dcat'

Usage

Configuration

Create a configuration file at ~/.catalogrc:

general:
    catalogdir: ./data

Commands

Create a catalog

$ dcatc [directory_path]

Creates a catalog file from the specified directory (or current directory if not specified).

Search catalogs

$ dcats [search_pattern]

Searches through catalog files for files matching the pattern.

Read compressed catalogs

$ dcatz [catalog_file.gz]

Alternative to zcat for reading compressed catalog files, especially useful on Windows.

Catalog File Format

Catalog files are stored as tab-separated values:

  • Column 1: Full file path
  • Column 2: Modification date (YYYY-MM-DD format)
  • Column 3: File size (bytes)
  • Column 4: File size rounded up to KB (e.g. 1 KB, 120,564 KB)

Files can be compressed with gzip (.gz extension) for efficient storage.

Examples

# Create a catalog of the current directory
$ dcatc

# Create a catalog of a specific directory
$ dcatc /path/to/directory

# Search for files containing "document"
$ dcats document

# Search for files with specific extension
$ dcats "*.pdf"

# Read a compressed catalog
$ dcatz catalog.gz

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests.

# Install dependencies
$ bundle install

# Run tests
$ rake test

# Build the gem
$ bundle exec rake build

# Install locally
$ bundle exec rake install

# Interactive console
$ bin/console

Requirements

  • Ruby >= 2.6.0
  • ripgrep (rg) command for searching functionality

Dependencies

  • sys-filesystem - For disk space information
  • zlib - For gzip compression/decompression

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/src256/dcat.

License

The gem is available as open source under the terms of the MIT License.