Skip to main content

Pseek is a Python library to search files, folders, and text

Project description

Pseek

Overview

A powerful command-line tool for searching files, directories, and content inside files efficiently. The tool supports searching by name, content, extensions, and more with advanced filtering options.

Features

  • Search in file & folder names
  • Search inside file contents
  • Highlight matches in terminal output
  • Optimized for speed with ThreadPoolExecutor
  • Support logical expression for search queries
  • Search inside archive files (e.g. zip, rar, 7z, gz, bz2, xz, tar, tar.gz, tar.bz2, tar.xz)
  • Cross-platform (Linux, macOS, Windows)

Installation

1 Install via pip (Recommended)

pip install pseek

2 Install from source

git clone https://github.com/ArianN8610/pysearch.git
cd pysearch
python -m venv venv
[Activate venv]
pip install click==8.1.8 lark==1.2.2 py7zr==1.0.0 rarfile==4.2 rapidfuzz==3.13.0

Usage

Run the command with a search query:

pseek <query> [options]

Examples

Search for a keyword in file & folder names

pseek "my_keyword" --path /path/to/search --file --directory

Search inside file contents

pseek "error" --path /var/logs --content

Search only in specific file types

pseek "TODO" --path ./projects --ext py --ext txt

Search by regex

pseek "error\d+" --regex

Command Options

Option Description
--path Base directory to search in (default: current directory .)
--file Search only in file names
--directory Search only in directory names
--content Search inside file contents
--ext, --exclude-ext Filter by file extension (e.g., txt, log)
--case-sensitive Make the search case-sensitive (except when --expr is enabled, in which case you can make it case sensitive by putting c before term: c"foo")
--regex Use regular expressions to search (except when --expr is enabled, in which case you can make it regex by putting r before term: r"foo")
--include, --exclude Limit search results to specific set of directories or files
--re-include, --re-exclude Limit search results to specific directories or files with regex
--word Match the whole word only (except when --expr is enabled, in which case you can make it match whole word by putting w before term: w"foo")
--expr Enable to write conditions in the query. Example: r"foo.*bar" and ("bar" or "baz") and not "qux" (To use regex, word, case-sensitive, and fuzzy features, you can use the prefixes r, w, c, and f before terms. Allowed modes: r, c, w, f, rc, cr, cw, wc, cf, fc, wf, fw, cwf, cfw, wcf, wfc, fcw, fwc. Examples: r"foo.*bar", wcf"Aple", cr".*Foo", ...)
--timeout To stop the search after a specified period of time (Seconds)
--fuzzy Enable fuzzy search (Highlighting and counting matches are disabled in this mode if --word is not enabled to prevent the program from slowing down). except when --expr is enabled, in which case you can make it fuzzy by putting f before term: f"foo"
--fuzzy_level Similarity threshold from 0 to 99 for fuzzy search (default: 80)
--max-size, --min-size Specify maximum and minimum sizes for files and directories
--archive Enable search within archive files (e.g. zip, rar, 7z, gz, bz2, xz, tar, tar.gz, tar.bz2, tar.xz)
--depth Maximum archive depth to recurse into (e.g. 2 means only 2 levels)
--arc-ext, --arc-ee Filter by file extension inside archive files
--arc-inc, --arc-exc Limit search results to specific set of directories or files inside archive files
--arc-max, --arc-min Specify maximum and minimum sizes for files inside archive files (It doesn't work for directories because their size is zero in archive files)
--rarfb Path to RAR backend tool (e.g. UnRAR.exe, ...)
--full-path Display full path of files and directories
--no-content Only display files path for content search

Requirements

  • Python 3.6 or higher
  • unrar, bsdtar, unar or 7zip for the rarfile library to support searching inside .rar files (optional)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pseek-2.5.4.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pseek-2.5.4-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file pseek-2.5.4.tar.gz.

File metadata

  • Download URL: pseek-2.5.4.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pseek-2.5.4.tar.gz
Algorithm Hash digest
SHA256 6b4b0a43d435da054718704cadbd2399c4e4f992fca1d229f9844929eb12dac7
MD5 c44c0c1aa7d8201958387b915d934d91
BLAKE2b-256 23686c6ccdd34a2bf1d7f9645e35c832e6c375bc71d347c0b27c9107a17d9125

See more details on using hashes here.

File details

Details for the file pseek-2.5.4-py3-none-any.whl.

File metadata

  • Download URL: pseek-2.5.4-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pseek-2.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 73e4e38ad1e7fd9b82bef18aabdf0e2d925375c27e59172a5d891d70dcba1ea2
MD5 20d4bb3598419a178c0c266545ac316a
BLAKE2b-256 0218f9478fa47bb1a3066be7ae0d3e5091361c1bf960c8331698340d5d544461

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page