惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 热门话题
G
GRAHAM CLULEY
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Recorded Future
Recorded Future
I
Intezer
云风的 BLOG
云风的 BLOG
博客园 - Franky
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
Attack and Defense Labs
Attack and Defense Labs
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
有赞技术团队
有赞技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
Webroot Blog
Webroot Blog
W
WeLiveSecurity
H
Heimdal Security Blog
博客园 - 三生石上(FineUI控件)
V
Vulnerabilities – Threatpost
G
Google Developers Blog
O
OpenAI News
V
V2EX
罗磊的独立博客
博客园_首页
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
TaoSecurity Blog
TaoSecurity Blog
Cloudbric
Cloudbric
H
Hacker News: Front Page
博客园 - 叶小钗
T
Tor Project blog
AI
AI

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Turn Your File System Into a SQL Database
Mukhtar · 2026-05-18 · via DEV Community

Stop grepping. Start querying.


The 2-Minute Version:

# Install and scan your Documents folder
brew tap surveilr/tap && brew install surveilr
surveilr admin init -d fs.db
surveilr ingest files -r ~/Documents -d fs.db

# Query it
surveilr shell -d fs.db

Enter fullscreen mode Exit fullscreen mode

-- Find every PDF modified this month
SELECT file_path, size_bytes, last_modified
FROM files
WHERE extension = 'pdf' AND last_modified > date('now', 'start of month');

Enter fullscreen mode Exit fullscreen mode

That's it. Your filesystem is now a SQLite database you can query forever.


The Problem with grep and find

You've been there:

find ~/Documents -name "*.pdf" -mtime -30 | xargs ls -lh

Enter fullscreen mode Exit fullscreen mode

It works. Until you need to:

  • Track changes over time
  • Join file metadata with other data
  • Build complex filters
  • Share results in a structured format
  • Query the same data six months later

Then your one-liner becomes a 200-line Bash script nobody can maintain.

Here's a different approach:

Turn your filesystem into a permanent SQLite database you can keep querying with standard SQL.

No scripts. No parsing. Just tables.


What surveilr Does

surveilr scans directories and captures everything into SQLite:

  • File paths and names
  • Sizes and timestamps
  • Content hashes (SHA-256)
  • Extensions and MIME types
  • Permissions and ownership

The output is a standard .db file you can:

  • Query with any SQLite tool
  • Open in DB Browser, DBeaver, DataGrip
  • Read with Python pandas or R
  • Keep forever (SQLite files last decades)
  • Share with teammates (just copy the file)

Step 1: Create a Database

surveilr admin init -d my-files.db

Enter fullscreen mode Exit fullscreen mode

This creates an empty SQLite database. That's it. No configuration, no setup, no servers.

You can open this file in any SQLite client right now and see the schema.


Step 2: Scan a Directory

surveilr ingest files -r ~/Documents -d my-files.db

Enter fullscreen mode Exit fullscreen mode

surveilr walks the directory tree and inserts metadata into two tables:

  • uniform_resource — Core metadata (hash, size, timestamps)
  • ur_ingest_session_fs_path_entry — File-specific data (paths, extensions)

Pro tip: Run multiple times to track changes over time. Each scan creates a new session.


Step 3: Query Like You Mean It

Open the SQL shell:

surveilr shell -d my-files.db

Enter fullscreen mode Exit fullscreen mode

Now you can run queries that would be painful in Bash.

Find all PDFs larger than 5MB

SELECT
    e.file_path_abs,
    e.file_basename,
    u.size_bytes / 1024 / 1024 AS size_mb
FROM uniform_resource u
JOIN ur_ingest_session_fs_path_entry e
  ON u.uniform_resource_id = e.uniform_resource_id
WHERE e.file_extn = 'pdf'
  AND u.size_bytes > 5242880
ORDER BY u.size_bytes DESC;

Enter fullscreen mode Exit fullscreen mode

Track file modifications over time

Run multiple scans, then query across sessions:

SELECT
    e.file_basename,
    COUNT(DISTINCT u.content_digest) AS versions,
    MIN(u.last_modified_at) AS first_seen,
    MAX(u.last_modified_at) AS last_modified
FROM uniform_resource u
JOIN ur_ingest_session_fs_path_entry e
  ON u.uniform_resource_id = e.uniform_resource_id
WHERE e.file_basename = 'report.docx'
GROUP BY e.file_basename;

Enter fullscreen mode Exit fullscreen mode

Find duplicate files by content hash

SELECT
    u.content_digest,
    COUNT(*) AS copies,
    SUM(u.size_bytes) / 1024 / 1024 AS total_mb_wasted
FROM uniform_resource u
JOIN ur_ingest_session_fs_path_entry e
  ON u.uniform_resource_id = e.uniform_resource_id
GROUP BY u.content_digest
HAVING copies > 1
ORDER BY total_mb_wasted DESC;

Enter fullscreen mode Exit fullscreen mode

Find files that changed in the last 7 days

SELECT
    e.file_path_abs,
    u.last_modified_at,
    u.size_bytes
FROM uniform_resource u
JOIN ur_ingest_session_fs_path_entry e
  ON u.uniform_resource_id = e.uniform_resource_id
WHERE u.last_modified_at > datetime('now', '-7 days')
ORDER BY u.last_modified_at DESC;

Enter fullscreen mode Exit fullscreen mode

These queries work on any SQLite database—forever.


Transform Structured Files Into Queryable Tables

surveilr doesn't just capture file metadata—it can extract and transform content from structured files.

This is where it gets interesting.

Transform CSV Files Into SQL Tables

Got CSV files? Turn them into queryable tables automatically:

surveilr orchestrate transform-csv -d my-files.db

Enter fullscreen mode Exit fullscreen mode

Every CSV file you ingested becomes a SQL table. If you scanned a directory with sales-2024.csv, you can now query it:

SELECT * FROM sales_2024 WHERE revenue > 10000;

Enter fullscreen mode Exit fullscreen mode

No manual schema definition. No import scripts. Just automatic table creation.

Extract Data from HTML Files with CSS Selectors

Ingested HTML files? Extract specific elements with CSS selectors:

# Extract all paragraphs inside divs
surveilr orchestrate transform-html -d my-files.db \
  --css-select "paragraphs:div > p"

# Extract all links
surveilr orchestrate transform-html -d my-files.db \
  --css-select "links:a[href]"

# Extract headers
surveilr orchestrate transform-html -d my-files.db \
  --css-select "headers:h1, h2, h3"

Enter fullscreen mode Exit fullscreen mode

The extracted data goes into JSON format you can query:

SELECT
    file_path,
    json_extract(transformed_content, '$.paragraphs') AS paragraphs
FROM uniform_resource
WHERE file_extn = 'html';

Enter fullscreen mode Exit fullscreen mode

Real-world use case: Scrape product data from saved HTML pages, extract structured content from documentation, parse scraped web pages.

Transform Markdown Files

Extract specific sections from Markdown files:

# Extract all headers
surveilr orchestrate transform-markdown -d my-files.db \
  --md-select "headers:# *"

# Extract code blocks
surveilr orchestrate transform-markdown -d my-files.db \
  --md-select "code:```
{% endraw %}
*
{% raw %}
```"

Enter fullscreen mode Exit fullscreen mode

Real-world use case: Index documentation, extract code examples from README files, parse technical notes.

Transform XML Files

XML files get automatically parsed into queryable JSON:

surveilr orchestrate transform-xml -d my-files.db

Enter fullscreen mode Exit fullscreen mode

Then query XML content with SQLite's JSON functions:

SELECT
    file_path,
    json_extract(transformed_content, '$.root.item[0].name') AS item_name
FROM uniform_resource
WHERE file_extn = 'xml';

Enter fullscreen mode Exit fullscreen mode

Real-world use case: Parse configuration files, process exported data from tools, analyze XML logs.

Why This Matters

Most file indexing tools just capture metadata.

surveilr extracts and transforms content so you can query inside your files.

This means you can:

  • Query values within CSV files, not just the file existence
  • Search for specific HTML elements across hundreds of pages
  • Extract code snippets from all Markdown docs
  • Parse XML configs and query their structure

Example workflow:

# 1. Ingest a directory of mixed files
surveilr ingest files -r ~/project-docs -d docs.db

# 2. Transform CSVs into tables
surveilr orchestrate transform-csv -d docs.db

# 3. Extract headers from Markdown
surveilr orchestrate transform-markdown -d docs.db --md-select "headers:# *"

# 4. Query across file types
surveilr shell -d docs.db

Enter fullscreen mode Exit fullscreen mode

-- Find all CSV files with revenue data
SELECT * FROM sales_data WHERE revenue > 50000;

-- Find all Markdown headers mentioning "API"
SELECT file_path, json_extract(transformed_content, '$.headers')
FROM uniform_resource
WHERE file_extn = 'md'
  AND json_extract(transformed_content, '$.headers') LIKE '%API%';

Enter fullscreen mode Exit fullscreen mode

You just turned a directory of mixed files into a queryable knowledge base.


Watch Mode: Continuous Indexing

Want surveilr to automatically re-index when files change?

surveilr ingest files -r ~/Documents -d my-files.db --watch

Enter fullscreen mode Exit fullscreen mode

surveilr monitors the directory and updates the database in real-time.

Press Ctrl+C to stop.


Export Results

Need to share findings? Export as JSON, CSV, or Markdown:

surveilr shell -d my-files.db --cmd "
SELECT file_path, size_bytes, last_modified
FROM files
WHERE extension = 'pdf'
" --output json > pdfs.json

Enter fullscreen mode Exit fullscreen mode

Or save queries as reusable SQL files:

cat > find-large-files.sql <<'EOF'
SELECT file_path, size_bytes / 1024 / 1024 AS size_mb
FROM files
WHERE size_bytes > 10485760
ORDER BY size_bytes DESC
LIMIT 20;
EOF

surveilr shell -d my-files.db find-large-files.sql

Enter fullscreen mode Exit fullscreen mode


Why Not Just Use Scripts?

You could write a Python script to walk directories and output JSON.

But:

Scripts have no schema.
Next month, you won't remember what fields you captured or what format you used.

surveilr creates stable SQL tables.
The schema is self-documenting.

Scripts don't track history.
You get a point-in-time snapshot, then it's gone.

surveilr accumulates sessions over time.
Run it weekly and query across months of history.

Scripts don't compose.
How do you join your file scan with your email data?

surveilr stores everything in one database.
Cross-domain joins just work.


Forensic Investigation Workflows

Once your filesystem is queryable, you can ask surprising questions:

Find files that disappeared

-- Files that existed in session 1 but not session 2
SELECT file_path
FROM files WHERE session_id = 'session_1'
EXCEPT
SELECT file_path
FROM files WHERE session_id = 'session_2';

Enter fullscreen mode Exit fullscreen mode

Track when specific files were modified

SELECT file_basename, last_modified_at, size_bytes
FROM files
WHERE file_basename LIKE '%contract%'
ORDER BY last_modified_at DESC;

Enter fullscreen mode Exit fullscreen mode

Find files created during a specific time window

-- Files created during a deployment window
SELECT file_path, last_modified
FROM files
WHERE last_modified BETWEEN '2024-05-10 14:00' AND '2024-05-10 15:00';

Enter fullscreen mode Exit fullscreen mode

These queries are impossible with find and grep.


Real-World Uses

For Developers

  • Track which files changed before/after a bug appeared
  • Find orphaned build artifacts
  • Identify large files bloating repos
  • Build custom file search tools

For Operations

  • Audit log file growth over time
  • Track config file changes
  • Find stale backups
  • Monitor disk usage trends

For Security Teams

  • Establish filesystem baselines
  • Detect unauthorized file modifications
  • Track file access patterns
  • Identify anomalous file creation

For Compliance (Oh, By the Way)

  • Document where regulated data lives (HIPAA PHI, GDPR PII)
  • Prove file retention policies
  • Provide audit evidence
  • Respond to data access requests

But the real power is permanent queryability.


Open the Database in Other Tools

Because surveilr outputs standard SQLite, you can use any SQLite tool:

  • DB Browser for SQLite — Visual database inspector
  • DBeaver — Universal database client
  • Datasette — Instant web UI for your database
  • Python pandaspd.read_sql_query(sql, 'sqlite:///my-files.db')
  • DuckDB — Fast analytical queries on SQLite files
  • VS Code SQLite extensions — Query in your editor

You own the .db file. Use whatever tools you want.


Troubleshooting

"Permission denied" errors?
Run with appropriate permissions or scan a different directory.

Database getting too large?
Use --dry-run to preview:

surveilr ingest files -r ~/Documents --dry-run

Enter fullscreen mode Exit fullscreen mode

Want to see what happened?
Add --stats to show ingestion summary:

surveilr ingest files -r ~/Documents -d my-files.db --stats

Enter fullscreen mode Exit fullscreen mode


What's Next?

You just turned your filesystem into a queryable database.

Now combine it with other data sources:

Or explore more:


The Bottom Line

Your filesystem should be queryable, not just searchable.

find and grep are great for one-off questions.

But when you need:

  • Historical tracking
  • Complex queries
  • Structured output
  • Composability
  • Permanence

...you want SQL.

surveilr turns your filesystem into a SQLite database you own forever.

No scripts. No parsing. Just queries.


Ready to query your filesystem? Install surveilr and run your first scan.

Get Started →