fselect - Search your local files using (relaxed) SQL syntax!

Submit command line tools that you find here.
Post Reply
Message
Author
User avatar
vevy
Posts: 752
Joined: Tue Sep 10, 2019 11:17 am

fselect - Search your local files using (relaxed) SQL syntax!

#1 Post by vevy » Sun Nov 15, 2020 5:55 am

One-liner: Find files with SQL-like queries

Description:
Why use fselect?

While it doesn't tend to fully replace traditional find and ls, fselect has these nice features:
  • SQL-like (not real SQL, but highly relaxed!) grammar easily understandable by humans
  • complex queries
  • aggregate, statistics, date, and other functions
  • search within archives
  • .gitignore, .hgignore, and .dockerignore support (experimental)
  • search by width and height of images, EXIF metadata
  • search by MP3 info
  • search by extended file attributes
  • search by file hashes
  • search by MIME type
  • shortcuts to common file types
  • interactive mode
  • various output formatting (CSV, JSON, and others)

The beauty of this incredible tool is the combinations and the functions:
fselect.exe select sha1, name from . where modified gt 2020-10-21 and is_file=1 and len(name) lt 10 :
  • Output = name and sha1 sum
  • From current folder (.)
  • certain last modified date
  • Only files (no folders)
  • Only names > 10 characters long!
You can even search by content:
get me all css files between 2-5 MB modified yesterday that contain the string "min-width"!

Code: Select all

fselect name where name=*.css and size gt 2m and "size<5mb" and modified=yesterday and contains(min-width)
Note that I don't have to choose "from folder" (assumed to be current folder). Also notices the various ways you can write greater/lesser than, date, units, etc.

The query can be as short as fselect name or fselect name,size To list names and sizes of files in the current directory.

Site: https://github.com/jhspetersson/fselect
Size: < 3MB
Entry: Link.
Last edited by vevy on Sun Nov 15, 2020 10:06 am, edited 3 times in total.
Help make the comprehensive CLI database happen:
                    Vote for filters/badges!

User avatar
webfork
Posts: 9869
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: fselect - Search your local files using (relaxed) SQL syntax!

#2 Post by webfork » Sun Nov 15, 2020 9:44 am

With some of the file searches I've been doing lately just getting more and more complex, I'll definitely check this out. Good add.

Post Reply