Live data from Hacker News

Show HN: FSQL – Search through your file system with SQL-esque queries

github.com

31–40 of 132 posts

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#31
post #23

Did someone come up with a generalized rule about putting SQL on top of every possible system that contains queryable information? Here is first-pass: >eventually every system that contains information that can be queried will have a sql interface

SQL is the standard language for querying relational data, so why not.

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#32

Didn't BeOS have some awesome database-like file system indexing and query system?

Sure; in general, a file system endowed with extended/extensible attributes can be naturally seen as a relational database (in which the files themselves are BLOBs).

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#33
post #29

For those of us on Windows: Everything [1] does the job quite nicely with much less verbose syntax. [1] http://voidtools.com

Does it keep everything local? I couldn't find anything on the FAQ and I remember a similar tool posted here on HN and people complained that it called home for some search functionality.

everything in Everything is local

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#35
post #18
post #12

Nice! I'm actually working on a similar project to push lsof and files from /proc into some postgres tables. Lets me do cool things like query log files across a ~6000 server infrastructure similar to: SELECT distinct(l.name) FROM lsof l, lsofer_runs r WHERE l.lsofer_id = r.id AND fd_type = 'REG' AND l.fd ~ '[0-9][uw]' AND l.name like '%log' GROUP BY l.name, r.hostname ORDER BY name Best of luck!

Looks very cool, is the code available anywhere? Would love to take a look.

The code is behind my company's GH, but here's a rewrite of the collector script:

https://github.com/red-bin/lsofer/blob/master/lsofer.sh

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#36
On macOS, there is a query syntax [0] that's usable in Spotlight and the mdfind(1) command. Richer searchable attributes [1], but the results may have to be piped through other tools for formatting or other output.

[0]: https://developer.apple.com/library/content/documentation/Ca...

[1]: https://developer.apple.com/library/content/documentation/Co...

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#37
post #25
post #11

Seems if the query is always going to start with SELECT, that maybe it should be assumed? I would never use this though, ack or find seem sufficient to me.

It's a shame Bash used 'select' as an elaborate menu built-in - it'd be quite neat to name the binary that (and drop the quotes). The you could just type the query right into your prompt!

Just use the fish shell instead, and you can avoid the years of shell cruft of bash, or the endless customization of zsh. Bash is a good environment for shell scripting, but not really the best for user interaction. Although perl is probably the best environment for shell scripting.

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#38

For those of us on Windows: Everything [1] does the job quite nicely with much less verbose syntax. [1] http://voidtools.com

I've been using this for years and it is LIGHTNING fast.

No need to "index" all the files because it reads directly from the MFT. If you create a new file matching the search pattern it's already sitting in the results window by the time you alt-tab.

Also, the "directory size" equivalent of Everything is WizTree [1] ... much faster than WinDirStat, which I see recommended way too often.

[1] http://antibody-software.com/web/software/software/wiztree-f...

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#39
post #19
post #15

Earlier quoted context omitted.

Subselects would be a pretty awesome feature. "select name from foo where name not in (select name from ../bar where date I'm usually fine with `find`, but when doing things more interesting than just "find files in this directory that are not in that directory", while uncommon, tend to make me think about my pipeline a bit.

Out of curiosity, I'm interested in how folks would do the "in this not that" folder query. At a gut shot, I'd assume that diff would be used. I'm about to dig through the find man page to see if it has something directly to help.

One tool for this is the 'comm' utility: given two files containing sorted lines, it can output one or more of (1) lines only in file 1, (2) lines only in file 2, and (3) lines common to both files.

Re: Show HN: FSQL – Search through your file system with SQL-esque queries

#40
post #26
post #19

Earlier quoted context omitted.

Out of curiosity, I'm interested in how folks would do the "in this not that" folder query. At a gut shot, I'd assume that diff would be used. I'm about to dig through the find man page to see if it has something directly to help.

Assuming no dups in file1, this outputs lines in file1 that aren't in file2: sort file1 file2 file2 | uniq -u (double file2 is not a typo :)

Or (a little faster):

  comm -23 
Post reply on HN