Skip to main content

SQL-like interface for querying files in your filesystem

Project description

File Query

A SQL-like interface for querying files in your filesystem.

Installation

# Clone the repository
git clone https://github.com/yourusername/file-query.git
cd file-query

# Install with pip
pip install -e .

# Or use UV
uv run python -m src.cli "your query"

# Install as a permanent tool with UV
uv tool install .
# This will install the 'fq' command

Usage

Command Line

The quickest way to run file-query is with UV:

uv run python -m src.cli "your query here"

After installation, you can use the shorthand command:

fq "your query here"

Basic Usage

# Find all Python files
fq "extension == 'py'"

# Find all text files and show their content
fq "extension == 'txt'" --show-content

Advanced Queries

File Query supports full SQL-like syntax:

# Find all Python files in the src directory
fq "SELECT * FROM 'src' WHERE extension == 'py'"

# Find all files larger than 100KB
fq "SELECT * FROM '.' WHERE size > 102400"

# Complex conditions
fq "SELECT * FROM '.' WHERE (extension == 'pdf' AND size > 1000000) OR (extension == 'txt' AND NOT name == 'README.txt')"

Query Syntax

File Query uses a SQL-like syntax:

SELECT * FROM 'directory_path' WHERE condition

Available Attributes

  • extension: File extension (without the dot)
  • name: Filename with extension
  • size: File size in bytes

Operators

  • Comparison: ==, !=, <, <=, >, >=
  • Logical: AND, OR, NOT

Examples

# Find all PDF files
fq "extension == 'pdf'"

# Find all files not named "main.py"
fq "NOT name == 'main.py'"

# Find all large image files
fq "SELECT * FROM '.' WHERE (extension == 'jpg' OR extension == 'png') AND size > 500000"

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

file_query_cli-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

file_query_cli-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: file_query_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.2

File hashes

Hashes for file_query_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2de7068e970252283770b0e34f3c3767a4e08ad78777ce18a286b435ddad49f6
MD5 80127cc2b5e013ad727005ea9d5f2581
BLAKE2b-256 51e2d965a359089d6d9fd0bccc741e19623014f6243c8ec12c9a0353aa938c31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for file_query_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8af71c8cb74dd36bddadbff288ae042f14ab4aca076423e3f0ba5019193c6eeb
MD5 f95f902f65044150ea7db359227b7535
BLAKE2b-256 1154a335c46c6870264d2c7a0e6872770444340b6615ba0660ef2d4fc3a73e34

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