CopyAll is a Python script designed to extract content from various file types within a directory and copy the aggregated content to your clipboard. It's especially useful for submitting code or text files to Large Language Models (LLMs) like Claude.ai for analysis or processing.
- Supports Multiple File Types: Works with a wide range of text-based files, including code files, Markdown, plain text, and even documents like
.docxand.pdf. - Customizable Extensions: Specify which file extensions to include or use the default set.
- Clipboard Management: Optionally save your current clipboard content before overwriting and restore it later.
- Verbose Output: Get detailed information about the script's operation for debugging or logging purposes.
-
Clone the Repository
git clone https://github.com/yourusername/copyall.git cd copyall -
Install Required Dependencies
Make sure you have Python 3 installed. Then install the necessary Python packages:
pip install -r requirements.txt
Alternatively, install packages individually:
pip install pyperclip PyPDF2 python-docx
-
Make the Script Executable and Accessible as
copyallTo run the script as a command-line tool, modify its permissions and move it to a directory in your system's
PATH:chmod +x copyall sudo mv copyall /usr/local/bin/copyall
This setup allows you to run the script from anywhere by simply typing
copyall.
Run the script with the default settings:
copyallThis will process all supported files in the current directory and copy their content to the clipboard.
-
directory: Specify the directory to process. Defaults to the current directory.copyall /path/to/directory
-
-e,--extensions: Comma-separated list of file extensions to include.copyall -e py,md,txt
-
-v,--verbose: Enable verbose output.copyall -v
-
-s,--save: Save the current clipboard content before copying new content.copyall -s
-
-r,--restore: Restore previously saved clipboard content.copyall -r
-
Process a Specific Directory with Default Extensions
copyall /path/to/directory
-
Process Current Directory with Specific Extensions
copyall -e py,js,html
-
Save Current Clipboard Content and Enable Verbose Output
copyall -s -v
-
Restore Previously Saved Clipboard Content
copyall -r
- Python 3: Ensure you have Python 3 installed.
- Required Python Packages:
pyperclip: For clipboard operations.PyPDF2: To extract text from PDF files.python-docx: To extract text from.docxfiles.
Install dependencies via pip:
pip install pyperclip PyPDF2 python-docxContributions are welcome! Please fork the repository and submit a pull request.
- Fork it
- Create your feature branch (
git checkout -b feature/awesome-feature) - Commit your changes (
git commit -am 'Add awesome feature') - Push to the branch (
git push origin feature/awesome-feature) - Create a new Pull Request