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.
- 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
Install the gem by executing:
$ gem install dcatOr add to your Gemfile:
gem 'dcat'Create a configuration file at ~/.catalogrc:
general:
catalogdir: ./data$ dcatc [directory_path]Creates a catalog file from the specified directory (or current directory if not specified).
$ dcats [search_pattern]Searches through catalog files for files matching the pattern.
$ dcatz [catalog_file.gz]Alternative to zcat for reading compressed catalog files, especially useful on Windows.
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.
# 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.gzAfter 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- Ruby >= 2.6.0
ripgrep(rg) command for searching functionality
sys-filesystem- For disk space informationzlib- For gzip compression/decompression
Bug reports and pull requests are welcome on GitHub at https://github.com/src256/dcat.
The gem is available as open source under the terms of the MIT License.