Skip to content

Python script to copy all code recursively in a folder for use with LLMs

Notifications You must be signed in to change notification settings

heysarver/file-enumerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

file-enumerator

Copy code in a folder for use with LLMs.

Aims to honor .gitignore and .dockerignore files and ignore all dev and non-text files.

Perfect for use with pbcopy or outputting to a text file.

Requirements

  • libmagic

    macOS

    $ brew install libmagic

    Linux (Debian/Ubuntu)

    $ sudo apt-get install libmagic1

    Windows

    On Windows, you can install the python-magic-bin package which includes the necessary binaries.

    $ pip install python-magic-bin

Usage

Create a virtual environment, unless installing on host.

macOS/Linux

$ python3 -m venv venv && source venv/bin/activate

Windows

$ python -m venv venv && .\venv\Scripts\activate

Install requirements

$ pip install -r requirements.txt

Run. On macOS this works great in combination with pbcopy

# macOS/Linux
$ python file_enumerator.py ~/workspace/path/to/copy

# Windows
$ python file_enumerator.py C:\path\to\copy

If you do not provide a path to copy, the current directory will be used.

Installation

  1. Install the necessary requirements and python libraries as noted above.
  2. Alias the script. This can be added to your ~/.bashrc or ~/.zshrc file on macOS/Linux, or set up as a function in PowerShell on Windows.

macOS/Linux

$ alias file_enum='python /path/to/file_enumerator.py'

Windows (PowerShell)

function file_enum {
    python C:\path\to\file_enumerator.py $args
}

About

Python script to copy all code recursively in a folder for use with LLMs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages