TL;DR — Quick Summary
fselect lets you find files using SQL-like queries. SELECT name, size FROM /home WHERE ext = 'rs' AND size > 1mb — it's SQL for your filesystem.
fselect turns file search into SQL. If you know SQL, you already know fselect — SELECT, FROM, WHERE, ORDER BY, GROUP BY for your filesystem.
Installation
# macOS
brew install fselect
# Cargo
cargo install fselect
# Binary download from GitHub
Usage
# Find files by extension
fselect name, size from /home where ext = 'rs'
# Large files
fselect name, size from . where size gt 100mb order by size desc
# Recently modified
fselect name, modified from . where modified gt 2024-01-01
# By name pattern
fselect name from . where name like '%test%'
# Count files by extension
fselect "ext, count(*)" from . group by ext order by "count(*)" desc
# Total size per extension
fselect "ext, sum(size)" from . group by ext
# Find duplicates by size
fselect "size, count(*), name" from . where size gt 0 group by size having "count(*) > 1"
# Search content
fselect name from . where contains = 'TODO'
# Images with EXIF
fselect name, width, height from . where ext = 'jpg'
# Specific depth
fselect name from . where depth le 2
# Multiple directories
fselect name from /home, /tmp where ext = 'log'
# Permissions
fselect name, mode from . where is_dir = true
# Output formats
fselect name from . where ext = 'md' into json
fselect name from . where ext = 'md' into csv
Comparison
| Feature | fselect | find | fd | SQL |
|---|---|---|---|---|
| Syntax | SQL-like | Flags | Simple | SQL |
| Aggregates | Yes | No | No | Yes |
| Group By | Yes | No | No | Yes |
| Content search | Yes | No | No | N/A |
| EXIF | Yes | No | No | N/A |
| JSON/CSV | Yes | No | No | Yes |
Summary
- fselect uses SQL syntax to find and query files on your filesystem
- SELECT fields, FROM directories, WHERE conditions, ORDER BY, GROUP BY
- Aggregate functions: COUNT, SUM, AVG, MIN, MAX
- Search file content, read EXIF metadata, check permissions
- Output to JSON, CSV, or formatted table