A powerful Python script that scans directories and copies files with specified extensions to your clipboard in a well-formatted Markdown structure. Perfect for sharing code with LLMs, code reviews, or documentation.
๐ What's New in v2.1.0:
- One-Command Setup: Run
setup.bat(Windows) or./setup.sh(Unix) to automatically install Python, configure PATH, and install dependencies!- Zero Configuration: No manual Python installation or PATH editing needed
- All Platforms: Windows, macOS, and Linux support with platform-specific installers
- ๐ Smart Extension Filtering: Specify extensions in the filename itself (e.g.,
copy.cs.md.py.py) - ๐ซ Folder Exclusion: Exclude specific folders from scanning (e.g.,
node_modules,dist) - ๐ฏ One-Command Setup: Automatic installation scripts for all platforms
- ๐ณ Recursive Scanning: Automatically scans subdirectories
- ๐ Detailed Statistics: Shows file count, size, and estimated LLM tokens
- ๐จ Syntax Highlighting: Outputs Markdown with proper language tags
- ๐ Auto-ignore: Skips common junk folders (
.git,node_modules, etc.) - ๐ฅ๏ธ Cross-Platform: Works on Windows, macOS, and Linux
Windows:
# Download the repository and run:
setup.batThis will automatically:
- โ Download and install Python if needed
- โ Add Python to PATH
- โ Install pyperclip
- โ Verify everything works
- โ Run Type Copy
Windows (PowerShell):
# Run as Administrator for best results
.\setup.ps1macOS/Linux:
# Make executable and run:
chmod +x setup.sh
./setup.sh-
Install Python (3.7 or higher)
- Windows: Download from python.org
- macOS:
brew install python3or download from python.org - Linux: Usually pre-installed, or
sudo apt install python3
-
Install dependencies:
pip install pyperclip
-
Download the script:
- Copy copy.cs.md.py.py to any folder you want to scan
The extensions you want to copy are specified in the filename itself:
copy.cs.md.py.py โ Copies .cs, .md, .py files
copy.js.ts.json.py โ Copies .js, .ts, .json files
copy.html.css.py โ Copies .html, .css files
Simply run the script:
python copy.cs.md.py.pyExclude specific folders:
python copy.cs.md.py.py --exclude test
python copy.cs.md.py.py --exclude node_modules --exclude dist
python copy.cs.md.py.py -e test -e docs # Short flagGet help:
python copy.cs.md.py.py --helpD:\type_copy\copy.cs.md.py.py
Scanning: D:\type_copy...
Added: README.md
Added: test\dir.test.cs
Added: test\dir.test.md
Added: test\dir.test.py
--------------------------------------------------
โ Success! Copied to clipboard.
Files: 4
Size: 1.67 KB
Tokens: ~426 (LLM Context)
--------------------------------------------------
Press Enter to close...
With exclusions:
python copy.cs.md.py.py --exclude test
Scanning: D:\type_copy...
Excluding: test
Added: README.md
--------------------------------------------------
โ Success! Copied to clipboard.
Files: 1
Size: 0.85 KB
Tokens: ~213 (LLM Context)
--------------------------------------------------- Python 3.7 or higher
- pyperclip library (
pip install pyperclip)
Linux: Requires a clipboard utility:
# Ubuntu/Debian
sudo apt install xclip
# Fedora
sudo dnf install xclip
# Arch
sudo pacman -S xclipmacOS:
No additional requirements (uses built-in pbcopy)
Windows: No additional requirements (uses built-in clipboard API)
On Windows, you may need to allow Python script execution. If you see an error like "cannot be loaded because running scripts is disabled", follow these steps:
python copy.cs.md.py.pyOpen PowerShell as Administrator and run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThis allows locally created scripts to run. This is safe and recommended by Microsoft.
powershell -ExecutionPolicy Bypass -File copy.cs.md.py.pyFor easy access, create a .bat file:
-
Create
run_copy.batin the same folder:@echo off python copy.cs.md.py.py %* pause
-
Double-click
run_copy.batto run
Or with exclusions:
@echo off
python copy.cs.md.py.py --exclude node_modules --exclude dist %*
pauseRun the test suite to verify everything works on your platform:
python test_copy.pyThe test suite includes:
- โ Basic file collection
- โ Folder exclusion (single and multiple)
- โ Cross-platform path handling
- โ Windows permissions
- โ Special characters in paths
- โ Edge cases
See TESTING.md for detailed testing guide.
Three setup scripts are provided for easy installation:
| Script | Platform | Features |
|---|---|---|
setup.bat |
Windows (CMD) | Auto-downloads Python, sets PATH, installs packages |
setup.ps1 |
Windows (PowerShell) | Same as .bat but with better error handling |
setup.sh |
macOS/Linux | Detects OS, installs Python & clipboard tools |
Running setup scripts:
# Windows - Double-click or run:
setup.bat
# Windows PowerShell (as Admin):
powershell -ExecutionPolicy Bypass -File setup.ps1
# macOS/Linux:
chmod +x setup.sh && ./setup.shAll setup scripts will:
- Check if Python is installed
- Install Python if missing (with user consent)
- Add Python to PATH
- Install required packages (pyperclip)
- Verify installation
- Run Type Copy
The script automatically ignores these common folders:
.git,.vs,.idea(version control & IDEs)Library,Temp,obj,Builds(Unity/build artifacts)__pycache__,node_modules(Python/Node packages)
.DS_Store(macOS)Thumbs.db(Windows)
The script includes syntax highlighting for 20+ languages including: C#, JavaScript, TypeScript, Python, Java, C/C++, HTML, CSS, SCSS, XML, YAML, JSON, Markdown, Bash, SQL, GLSL/HLSL, and more.
For a quick one-liner without this library:
find . -type f \( -name "*.cs" -o -name "*.md" \) -exec cat {} \; | xclip -selection clipboardNote: Requires xclip installed
Recording 2024-12-23 021135.mp4
- For AI/LLM Context: Use the token estimate to stay within context limits
- Large Projects: Exclude build/dependency folders with
--exclude - Windows Dev Home: Try with Windows Dev Home for enhanced features
- Git Integration: Check out git-copy.sh for git-aware copying
Found a bug or want to contribute? Feel free to open an issue or PR!
Free to use and modify for any purpose.
- Quick Reference - Command cheat sheet
- Setup Scripts Guide - Automatic installation details
- Windows Setup Guide - Detailed Windows instructions
- Testing Guide - How to run and write tests
- Changelog - Version history and updates
