This tool helps you copy the contents of multiple files to the clipboard, with each file's content prefixed by a comment indicating the file name.
It's useful for pasting entire projects into large language models (LLMs) for analysis.
- Reads contents of multiple files given as command-line arguments.
- Prefixes each file's content with a comment showing the file name.
- Copies the combined content to the clipboard.
- walks directories recursively and gathers all their files.
- Ignores non-text files.
- Can exclude files matching a list of paths, given as comma-separated list.
- Go 1.15 or higher
-
Ensure you have Go installed from golang.org.
-
Install the software
go install github.com:LeanerCloud/f2c@latest
Assuming the GOPATH/bin is in your PATH, you can run the program with the files you want to copy as arguments:
f2c *.txt
or
f2c --exclude .git . # -e works as well to save you some typing
The combined content will be copied to your clipboard, ready to paste.
Given these files:
file1.txt:
Hello, this is file1.
file2.txt:
Hello, this is file2.
Results in the clipboard containing:
// file1.txt
Hello, this is file1.
// file2.txt
Hello, this is file2.
This project is licensed under the MIT License.