{"id":13813479,"url":"https://github.com/laktak/zfind","last_synced_at":"2025-05-16T04:04:00.810Z","repository":{"id":242530454,"uuid":"809503375","full_name":"laktak/zfind","owner":"laktak","description":"search for files (even inside tar/zip/7z/rar) using a SQL-WHERE filter","archived":false,"fork":false,"pushed_at":"2024-11-06T22:12:54.000Z","size":104,"stargazers_count":389,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-08T18:53:14.676Z","etag":null,"topics":["cli","find","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laktak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"laktak"}},"created_at":"2024-06-02T21:41:04.000Z","updated_at":"2025-04-27T12:50:04.000Z","dependencies_parsed_at":"2024-08-03T19:51:17.167Z","dependency_job_id":"dfac60fa-ebb7-4655-841c-b4bd9ec93d79","html_url":"https://github.com/laktak/zfind","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":"0.050000000000000044","last_synced_commit":"f2f84763e17ca484b9a5375214e3d62107b4ec22"},"previous_names":["laktak/zfind"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laktak%2Fzfind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laktak%2Fzfind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laktak%2Fzfind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laktak%2Fzfind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laktak","download_url":"https://codeload.github.com/laktak/zfind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464891,"owners_count":22075570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","find","sql"],"created_at":"2024-08-04T04:01:19.094Z","updated_at":"2025-05-16T04:04:00.789Z","avatar_url":"https://github.com/laktak.png","language":"Go","funding_links":["https://github.com/sponsors/laktak"],"categories":["Go","\u003ca name=\"text-search\"\u003e\u003c/a\u003eText search (alternatives to grep)"],"sub_categories":[],"readme":"\n# zfind\n\n`zfind` allows you to search for files, including inside `tar`, `zip`, `7z` and `rar` archives. It makes finding files easy with a filter syntax that is similar to an SQL-WHERE clause. This means, if you know SQL, you don't have to learn or remember any new syntax just for this tool.\n\n- [Basic Usage \u0026 Examples](#basic-usage--examples)\n- [Where Syntax](#where-syntax)\n- [Properties](#properties)\n- [Supported archives](#supported-archives)\n- [Actions](#actions)\n- [Configuration](#configuration)\n- [Installation](#installation)\n  - [Binary releases](#binary-releases)\n  - [Homebrew (macOS and Linux)](#homebrew-macos-and-linux)\n  - [Arch Linux](#arch-linux)\n  - [Build from Source](#build-from-source)\n- [zfind as a Go module](#zfind-as-a-go-module)\n\n\n## Basic Usage \u0026 Examples\n\n```shell\nzfind \u003cwhere\u003e [\u003cpath\u003e...]\n```\n\nExamples\n\n```console\n# find files smaller than 10KB, in the current path\nzfind 'size\u003c10k'\n\n# find files in the given range in /some/path\nzfind 'size between 1M and 1G' /some/path\n\n# find files modified before 2010 inside a tar\nzfind 'date\u003c\"2010\" and archive=\"tar\"'\n\n# find files named foo* and modified today\nzfind 'name like \"foo%\" and date=today'\n\n# find files that contain two dashes using a regex\nzfind 'name rlike \"(.*-){2}\"'\n\n# find files that have the extension .jpg or .jpeg\nzfind 'ext in (\"jpg\",\"jpeg\")'\n\n# find directories named foo and bar\nzfind 'name in (\"foo\", \"bar\") and type=\"dir\"'\n\n# search for all README.md files and show in long listing format\nzfind 'name=\"README.md\"' -l\n\n# show results in csv format\nzfind --csv\nzfind --csv-no-head\n```\n\n## Where Syntax\n\n- `AND`, `OR` and `()` parentheses are logical operators used to combine multiple conditions. `AND` means that both conditions must be true for a row to be included in the results. `OR` means that if either condition is true, the row will be included. Parentheses are used to group conditions, just like in mathematics.\n\nExample: `'(size \u003e 20M OR name = \"temp\") AND type=\"file\"'` selects all files that are either greater than 20 MB in size or are named temp.\n\n- Operators `=`, `\u003c\u003e`, `!=`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=` are comparison operators used to compare values and file properties. The types must match, meaning don't compare a date to a file size.\n\nExample: `'date \u003e \"2020-10-01\"'` selects all files that were modified after the specified date.\n\n- `LIKE`, `ILIKE` and `RLIKE` are used for pattern matching in strings.\n  - `LIKE` is case-sensitive, while `ILIKE` is case-insensitive.\n  - The `%` symbol is used as a wildcard character that matches any sequence of characters.\n  - The `_` symbol matches any single character.\n  - `RLIKE` allows matching a regular expression.\n\nExample: `'\"name like \"z%\"'` selects all files whose name starts with 'z'.\n\n- `IN` allows you to specify multiple values to match. A file will be included if the value of the property matches any of the values in the list.\n\nExample: `'\"type in (\"file\", \"link\")'` selects all files of type file or link.\n\n- `BETWEEN` selects values within a given range (inclusive).\n\nExample: `'\"date between \"2010\" and \"2011-01-15\"'` means that all files that were modified from 2010 to 2011-01-15 will be included.\n\n- `NOT` is a logical operator used to negate a condition. It returns true if the condition is false and vice versa.\n\nExample: `'\"name not like \"z%\"'`, `'\"date not between \"2010\" and \"2011-01-15\"'`, `'\"type not in (\"file\", \"link\")'`\n\n- Values can be numbers, text, date and time, `TRUE` and `FALSE`\n  - dates have to be specified in `YYYY-MM-DD` format\n  - times have to be specified in 24h `HH:MM:SS` format\n  - numbers can be written as sizes by appending `B`, `K`, `M`, `G` and `T` to specify bytes, KB, MB, GB, and TB.\n  - empty strings and `0` evaluate to `false`\n\n\n## Properties\n\nThe following file properties are available:\n\n| name        | description                                                       |\n|-------------|-------------------------------------------------------------------|\n| name        | name of the file                                                  |\n| path        | full path of the file                                             |\n| container   | path of the container (if inside an archive)                      |\n| size        | file size (uncompressed)                                          |\n| date        | modified date in YYYY-MM-DD format                                |\n| time        | modified time in HH-MM-SS format                                  |\n| ext         | short file extension (e.g., `txt`)                                |\n| ext2        | long file extension (two parts, e.g., `tar.gz`)                   |\n| type        | `file`, `dir`, or `link`                                          |\n| archive     | archive type: `tar`, `zip`, `7z`, `rar` or empty                  |\n\nHelper properties\n\n| name        | description                                                       |\n|-------------|-------------------------------------------------------------------|\n| today       | today's date                                                      |\n| mo          | last monday's date                                                |\n| tu          | last tuesday's date                                               |\n| we          | last wednesday's date                                             |\n| th          | last thursday's date                                              |\n| fr          | last friday's date                                                |\n| sa          | last saturday's date                                              |\n| su          | last sunday's date                                                |\n\n\n## Supported archives\n\n| name        | extensions                                                        |\n|-------------|-------------------------------------------------------------------|\n| tar         | `.tar`, `.tar.gz`, `.tgz`, `.tar.bz2`, `.tbz2`, `.tar.xz`, `.txz` |\n| zip         | `.zip`                                                            |\n| 7zip        | `.7z`                                                             |\n| rar         | `.rar`                                                            |\n\n\u003e Note: use the flag -n (or --no-archive) to disable archive support. You can also use `'not archive'` in your query but this still requires zfind to open the archive.\n\n\n## Actions\n\nzfind does not implement actions like `find`, instead use `xargs -0` to execute commands:\n\n```shell\nzfind --no-archive 'name like \"%.txt\"' -0 | xargs -0 -L1 echo\n```\n\nzfind can also produce `--csv` (or `--csv-no-head`) that can be piped to other commands.\n\n\n## Configuration\n\nSet the environment variable `NO_COLOR` to disable color output.\n\n\n## Installation\n\n\n### Binary releases\n\nYou can download the official zfind binaries from the releases page and place it in your `PATH`.\n\n- https://github.com/laktak/zfind/releases\n\nPrereleased versions can be found directly on the [GitHub Action](https://github.com/laktak/zfind/actions). Click on the latest `ci` action and look for `prerelease-artifacts` at the bottom.\n\n### Homebrew (macOS and Linux)\n\nFor macOS and Linux it can also be installed via [Homebrew](https://formulae.brew.sh/formula/zfind):\n\n```shell\nbrew install zfind\n```\n\n### Arch Linux\n\nzfind is available in the AUR as [zfind](https://aur.archlinux.org/packages/zfind/):\n\n```shell\nparu -S zfind\n```\n\n### Build from Source\n\nBuilding from the source requires Go.\n\n- Either install it directly\n\n```shell\ngo install github.com/laktak/zfind/cmd/zfind@latest\n```\n\n- or clone and build\n\n```shell\ngit clone https://github.com/laktak/zfind\nzfind/scripts/build\n# output is here:\nzfind/zfind\n```\n\n\n## zfind as a Go module\n\nzfind is can also be used in other Go programs.\n\n```\ngo get github.com/laktak/zfind\n```\n\nThe library consists of two main packages:\n\n- [filter](https://pkg.go.dev/github.com/laktak/zfind/filter): provides functionality for parsing and evaluating SQL-where filter expressions\n- [find](https://pkg.go.dev/github.com/laktak/zfind/find): implements searching for files and directories.\n\nFor more information see the linked documentation on pkg.go.dev.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaktak%2Fzfind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaktak%2Fzfind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaktak%2Fzfind/lists"}