5 releases
Uses new Rust 2024
new 0.2.4 | Apr 10, 2025 |
---|---|
0.2.3 | Apr 10, 2025 |
0.2.2 | Apr 10, 2025 |
0.2.1 | Apr 10, 2025 |
0.2.0 | Apr 10, 2025 |
#615 in Filesystem
98KB
1.5K
SLoC
🔍 FMQL - File Management for People Who Talk to Databases
Because talking to your files like they're a database is totally normal.
What is this madness?
FMQL (File Manager Query Language) lets you use SQL (sort of) to manage your files.
It puts the "Q" into "FML".
Yes it was mostly vibe-coded, I've been meaning to write this for months and this way I finally got round to it.
⚠️ WARNING: This code is buggy as hell. Use at your own risk. Don't blame me when it deletes your homework or accidentally formats your hard drive. I'm still working on it, and by "working on it," I mean "not working on it very much at all because I don't have time right now".
SELECT * FROM ~/Documents WHERE size > 1000000 AND modified > '2025-01-01'
-- Translation: "Show me all those chonky files I created this year"
✨ Features That Will Make Your Files Feel Special
- SQL-like Querying:
SELECT * FROM ~/memes WHERE extension = 'jpg' AND name LIKE '%cat%'
because who needs GUI file search when you can type a novel? - Slightly Fast: Traverses your filesystem faster than you can say "where did I put that file again?" ten times.
- Detailed File Info: Size, permissions, timestamps, and more. Like
ls -la
but dysfunctional and with a bad attitude. - Sophisticated Sorting: By name, size, modified date, or type.
- Grouping Options: Group by extension, permissions, or name patterns.
- Recursive Listing: Who needs
fd
when you can use fmql? (Everybody, actually.) - Multiple Output Formats: Text, table, or JSON. Text and table are basically the same so "two output formats" is more accurate.
🔧 Installation (No Magic Required)
# The easy way
cargo install fmql
# The less way
git clone https://github.com/chriswmann/fmql.git
cd fmql
cargo build --release
📚 Usage: How to Pretend Your File System is a SQL Server DB from 1989?
Basic File Listing (which will probably be deleted because ls
, exa
and eza
are infinitely better)
# List files in current directory (boring, but effective)
fmql ls
# Show hidden files (where the real secrets hide)
fmql ls -a
# Detailed listing (for people who need to know EVERYTHING)
fmql ls -l
# Sort by size (big files first, because size matters)
fmql ls -s size
# Recursively list directories (for brave souls)
fmql ls -r
SQL Mode (Because Why Not?)
# Find all text files in your Documents
fmql sql "SELECT * FROM ~/Documents WHERE extension = 'txt'"
# Find large images modified recently
fmql sql "SELECT * FROM ~/Pictures WHERE (extension = 'jpg' OR extension = 'png') AND size > 1000000 AND modified > '2023-06-01'"
# Find executable scripts (your personal army of automation)
fmql sql "SELECT * FROM ~/scripts WHERE permissions LIKE '%x%'"
# Update file permissions (because chmod is so 1970s)
fmql sql "UPDATE ~/scripts SET permissions = '755' WHERE extension = 'sh'"
🎮 Command Options
LS Mode Options
-a, --all
: Show hidden files (the ones wearing invisibility cloaks)-l, --long
: Use detailed view (for file stalkers)-s, --sort <OPTION>
: Sort by:name
,size
,modified
,type
(the Sorting Hat for files)-r, --recursive
: Recursively list directories (it's directories all the way down!)-t, --total
: Show total size (how much disk space you're wasting)-g, --group-by <OPTION>
: Group by:folder
,extension
,permissions
, etc. (file segregation, but the ethical kind)-f, --format <FORMAT>
: Output as:text
,table
,json
(dress your output fancy)
SQL Query Stuff
FMQL understands these SQL-ish commands:
SELECT
: Find files matching specific conditionsUPDATE
: Modify file attributes (permissions, etc.)WHERE
: Filter with conditions (=
,>
,<
,LIKE
,REGEXP
)WITH RECURSIVE
: Recursively search directories (prepare for deep dives)
Examples
# Find all your unfinished projects
fmql sql "SELECT * FROM ~/projects WHERE modified < '2023-01-01' AND NOT name LIKE '%completed%'"
# List all memes sorted by size
fmql sql "SELECT * FROM ~/Downloads WHERE name LIKE '%meme%' ORDER BY size DESC"
# Find screenshots from 3am
fmql sql "SELECT * FROM ~/Pictures WHERE name LIKE '%screenshot%' AND modified LIKE '%03:%'"
# Look for suspicious executables
fmql sql "SELECT * FROM ~/Downloads WHERE is_executable = true AND NOT permission = '755'"
🤝 Contributing
- Question your life choices
- Fork the repo
- Create your feature branch (
git checkout -b feature/amazing-idea
) - Write code that doesn't make kittens cry
- Commit your changes (
git commit -m 'Added that thing everyone wanted'
) - Push to the branch (
git push origin feature/amazing-idea
) - Open a Pull Request
- Wait anxiously for feedback while refreshing GitHub every 30 seconds
📜 License
MIT License - Feel free to use this for whatever you like
Dependencies
~8–19MB
~295K SLoC