Skip to main content

Find files recursively and optionally print their contents.

Project description

Recursive Output Utility

Overview

This Python script recursively searches for files based on their extensions starting from a specified directory. It can print the directory structure, include or exclude specific files, use syntax highlighting for output, and anonymize file paths for privacy.

Requirements

  • Python 3.10 or higher,
  • bat (optional, for syntax highlighting),

Installation

Using pip

python -m pip install routput

On some systems, you may need to put the version number of python:

python3.12 -m pip install routput

For the sake of simplicity, whenever I mention python in the following sections, you can replace it with python3.x version if necessary.

From source

Clone this repository.

git clone https://github.com/nacioboi/routput.git

Navigate to the repository directory.

cd routput

And install the package.

python -m pip install .

Usage

python -m routput [options]

Options

  • -d, --starting-directory: Directory to start the search from (default: current directory).
  • -s, --do-print-structure: Print the directory structure.
  • -e, --extensions: List of file extensions to search for, format [ext1,ext2,...] (default: [c,h]).
  • -p, --do-protect-privacy: Anonymize file paths.
  • -a, --also-include: List of additional filenames to include, format [file1,file2,...].
  • -i, --ignore: List of filenames to ignore, format [file1,file2,dir1,dir2...].
  • -n, --no-print: Don't print the files, just return them.
  • -b, --do-use-bat: Use bat for syntax highlighting.
  • -c, --do-colors: Use different colors for each file type.
  • -h, --help: Show help message and exit.

Examples

To print the structure of a directory:

python -m routput.py -d /path/to/directory -s

To find and print .py files in the current directory, using bat for highlighting:

python routput.py -e [py] -b

License

Open-source software licensed under GPL-2 license.

V0.3 released on 18th/4/2024

among other small changes, a --script option has been added.

  • updated README.md to show correct usage,
  • made it so the __name__ of the module is routput when the help is displayed.
  • added an example for the --script option.

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

routput-0.3.tar.gz (15.2 kB view details)

Uploaded Source

File details

Details for the file routput-0.3.tar.gz.

File metadata

  • Download URL: routput-0.3.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for routput-0.3.tar.gz
Algorithm Hash digest
SHA256 b0b568768a9c6cabe6640a35f312ca74992ae491a61f5b40380e209136ec8235
MD5 82ba0876cb9ce79acb507547a1c0224c
BLAKE2b-256 86613f9ea5ac82997286b83ff8ab23c9fdba6d60f0ca20d7d5b6833c0af3de6c

See more details on using hashes here.

Supported by

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