Skip to main content

pyfindlib

Shell utility resembling findutils. Small, extendable and Windows-friendly.

Install

pip install pyfindlib

Use

usage: pyfind [PATHS] [OPTIONS] [PREDICATES] [ACTION]

finds files and dirs that satisfy predicates and executes action

options:
  -maxdepth NUMBER     walk no deeper than NUMBER levels
  -output PATH         output to file instead of stdout
  -append              append to file instead of rewrite
  -trail               print trailing slash on directories
  -cdup NUMBER         print (or perform action on) parent path (strip NUMBER 
                       trailing components from path)
  -first NUMBER        print (or perform action on) first NUMBER found items and stop
  -skip PATTERNS       do not go into dirs with name that matches one of PATTERNS (wildcard) 
                       and do not act on files with name that matches one of PATTERNS

predicates:
  -type d              is directory
  -type f              is file
  -mtime DAYS          if DAYS is negative: modified within DAYS days, 
                       if positive modified more than DAYS days ago
  -ctime DAYS          same as -mtime, but when modified metadata not content
  -mmin MINUTES        if MINUTES is negative: modified within MINUTES minutes, 
                       if positive modified more than MINUTES minutes ago
  -mdate DATE1 [DATE2] modified at DATE1 (or between DATE1 and DATE2)
  -cmin MINUTES        same as -mmin, but when modified metadata not content
  -newer PATH/TO/FILE  modified later than PATH/TO/FILE
  -newermt DATETIME    modified later than DATETIME
  -newerct DATETIME    same as -newermt but when modified metadata not content
  -name PATTERNS       filename matches one of PATTERNS (wildcard)
  -iname PATTERNS      same as -name but case insensitive
  -path PATTERNS       file path matches one of PATTERNS (wildcard)
  -ipath PATTERNS      same as -path but case insensitive
  -grep PATTERN        file content contains one of PATTERNS (regexp)
  -igrep PATTERN       same as -grep but case insensitive
  -bgrep PATTERN       same as -grep but PATTERN is string of hex values
  -docgrep PATTERN     grep odt and ods files for PATTERN
  -xlgrep ...ARGS      grep xls files for values, each arg is one of: address range (c1:c10), 
                       numeric value (40.8), numeric range (40..41) or string (foo)
  -cpptmp              temporary cpp files (build artifacts - objects, generated code)
  -zippath PATTERNS    zip containing file with path that matches one of PATTERNS (wildcard)
  -zipipath PATTERNS   same as -zippath but PATTERNS are case insensitive
  -dirwith PATTERNS    directory contains entry with name that matches one of PATTERNS (wildcard)
  -dirwithf PATTERNS   directory contains file with name that matches one of PATTERNS (wildcard)
  -dirwithd PATTERNS   directory contains subdirectory with name that matches one of PATTERNS (wildcard)
  -video               video files (*.mkv *.mp4 *.mov *.webm *.flv *.avi *.mpg *.mpeg *.wmv)
  -image               image files (*.jpg *.jpeg *.png *.gif *.webp *.svg *.bmp *.ico *.tif *.tiff)

predicates can be inverted using -not, can be grouped together in boolean expressions 
using -or and -and and parenthesis
          
actions:
  -print               print matched paths to output (default action)
  -delete              delete matched file
  -exec COMMAND ;      execute COMMAND
  -touch               touch file (set mtime to current time)
  -gitstat             print git status summary
  -extstat             filesize and filecount stat by file extension
  -copy DST            copy file to DST
  -move DST            move file to DST 

print action options:
  -abspath             print absolute paths
  -basename            print basename
  -stat                print paths with file size and modification date

exec action options:
  -async               execute asyncronously (do not wait for termination)
  -xargs               execute command once with all matched files as arguments
  -conc NUMBER         concurrency limit for -async -exec, 
                       defaults to number of cpu cores

exec action bindings:
  {}          path to file
  {path}      path to file
  {name}      name with extension
  {ext}       extension
  {basename}  name without extension
  {dirname}   directory name

copy and move action options:
  -tree                copy (move) preserving relative path (default)
  -flat                copy (move) without preserving relative path
  -noover              do not overwrite existing files (files are compared by size and name)
  -rename              rename files to avoid overwriting existing files

examples:
  pyfind -iname *.py -mmin -10
  pyfind -iname *.cpp *.h -not ( -iname moc_* ui_* ) -xargs -exec pywc -l ;
  pyfind -iname *.h -exec pygrep -H class {} ;
  pyfind -iname *.o -delete
  pyfind D:\dev -iname node_modules -type d -cdup 1
  pyfind -iname *.dll -cdup 1 -abspath | pysetpath -o env.bat
  pyfind -iname *.mp3 -conc 4 -async -exec ffmpeg -i {} {dirname}\{basename}.wav ;
  pyfind -mdate 2024-07-25
  pyfind -mdate 2024-07-25 2024-08-21
  pyfind -newer path/to/file
  pyfind D:\dev -maxdepth 1 -gitstat
  pyfind D:\dev -dirwith __init__.py
  pyfind D:\dl -extstat
  pyfind C:\Qt\6.7.1 -iname *.dll -bgrep "5571feff"
  pyfind D:\doc -xlgrep c1:c10 30.8 40..41 foo
  pyfind -iname *.txt -xargs -exec 7z a texts.zip ;
  pyfind -zipipath *.mtl
  pyfind D:\dl -image -copy E:\backup\dl -noover
  pyfind D:\dev\blog -skip .git node_modules -mtime -10 -stat

See also

https://github.com/mugiseyebrows/mugi-cli

Metadata

Release files for pyfindlib 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfindlib 0.0.5
File Size Uploaded Provenance
pyfindlib-0.0.5.tar.gz 19.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfindlib 0.0.5
File Interpreter ABI Platform
pyfindlib-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 42.1 kB

Release files / pyfindlib-0.0.5.tar.gz

Download URL pyfindlib-0.0.5.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ca8d0927123a6c2a625d56daa00219d08e38f59569dd9b2a53f6fdc9622316af
BLAKE2b-256 checksum
How to use checksums
59e6724aa2497ed2474978a87fb01014ae98cb8c20d807d1d843c1db01989492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release files / pyfindlib-0.0.5-py3-none-any.whl

Download URL pyfindlib-0.0.5-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6feca8fcd3ce8120491a89d91384c60d5f0c5b4655353aa5657316f9631449c8
BLAKE2b-256 checksum
How to use checksums
aa3d5e045581bb4d068abb9dde9b4a1a25deaf17fc9a82a8633c605fde57a5a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Security for pyfindlib 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page