A simple desktop app that collects a project's source code into a single text file - ready to paste into an AI chat or share.
CodeCollector walks through a project folder, picks up the source files worth sharing and joins them into one text file. Every file is preceded by a header with its relative path, so the result stays easy to read and navigate. After the export, the app shows a colorized preview where you can save the file to a location of your choice or copy everything to the clipboard.
Collecting code
- Recursively collects source files from the selected project folder
- Skips directories such as
.git,.idea,.vscode,__pycache__,venv,node_modules,distandbuild - Supports many languages (Python, JavaScript/TypeScript, C#, Java, Kotlin, C/C++, Go, Rust, PHP, Swift, Dart, SQL, HTML/CSS and common config formats)
- Reads files in several encodings (UTF-8, UTF-8 with BOM, CP1250, Latin-1)
- Asks for confirmation before processing very large projects
Result window
- Syntax-highlighted preview, adapted to the light and dark theme
- Save location shown up front (defaults to the project folder) and changeable with a "Save as" dialog
- Save file writes the full text to the chosen path
- Copy all copies the full, uncolored text to the clipboard
Interface
- Clean, minimal window built with CustomTkinter
- Follows the system light/dark mode
- Progress indicator while the project is being scanned
Once the export is finished, the result window opens next to the main window.
A syntax-highlighted preview, the save location (changeable with Change...) and the Save file / Copy all buttons.
Want to see what the program produces? project_code.txt is the real export of this very repository - one text file with a header (the relative path) above every source file.
The code is split into small modules with a single responsibility each:
CodeCollector/
├── main.py # Entry point
├── gui.py # Main window: folder selection and Generate button
├── result_window.py # Result window: preview, save location, Save / Copy all
├── highlight.py # Syntax highlighting of the preview (Pygments)
├── exporter.py # Collecting, reading and joining files, saving the result
├── config.py # Ignored folders, file extensions, limits, fonts
└── requirements.txt # Python dependencies
All tunable settings live in config.py:
IGNORE_DIRS/IGNORE_FILES: folders and files that are never exportedINCLUDE_EXTENSIONS: file extensions that are exportedWARNING_FILE_LIMIT: number of files above which the app asks for confirmationPREVIEW_LIMIT: maximum number of characters shown in the preview (saving and copying always use the full text)OUTPUT_FILE_NAME: default name of the generated file
| Layer | Technologies |
|---|---|
| Language | Python 3 |
| GUI | CustomTkinter (Tkinter) |
| Syntax highlighting | Pygments |
Requires Python 3.10 or newer.
- Clone the repository:
git clone https://github.com/Narothe/CodeCollector.git
cd CodeCollector- Create a virtual environment and install the dependencies:
python -m venv .venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS / Linux
pip install -r requirements.txt- Run the app:
python main.py- Click Browse and select the project folder.
- Click Generate.
- In the result window, check the preview and choose what to do:
- Save file - writes
project_code.txtto the path shown in the Save to field (use Change... to pick another location), - Copy all - copies everything to the clipboard,
- Close - closes the window without saving.
- Save file - writes
This project is licensed under the MIT License - see the LICENSE file for details.


