DEV Community

uni928
uni928

Posted on

I Created a Tool to Copy All Files in a Folder to Your Clipboard

Introduction

When working with ChatGPT or other LLMs (Large Language Models), you may find yourself needing to paste the names and contents of all files in a directory into a prompt — more often than you’d expect.

For example:

・When you want GPT to understand the structure of an entire codebase
・When analyzing a project that includes multiple templates or config files
・When summarizing a folder full of Markdown or text documents
・When previewing content before running a batch job
・When quickly documenting a local folder that isn’t under version control

In all these cases, “showing the content itself” becomes valuable input to the AI or to your workflow.

The Tool

To solve this, I built a simple web-based tool that lets you:

👉 Select a folder
👉 Recursively read all files inside
👉 Copy their filenames and contents into your clipboard

No installation. No account. Runs entirely in the browser.
Try it here:

🔗 https://uni928.github.io/DirectoryInFileAllCopy/index2.html

If you'd like to inspect or run it locally before using, you can also download it from here.

How to Use

  1. Visit the site linked above
  2. Click the “Select Folder” button
  3. Choose the folder you want to copy and click OK
  4. Within a few seconds, the contents of all valid files will be copied to your clipboard!

⚠️ Files with certain extensions like .meta are automatically excluded. You can customize which extensions are skipped if needed.

Technical Background (briefly)

This tool uses the File System Access API, with the following conditions:

・Works on Chromium-based browsers (Chrome, Edge, Brave, etc.)
・Only available over HTTPS or on localhost
・Folder access requires explicit user interaction due to browser security policies

Internally, it recursively traverses the folder, reads each file as text, formats it into a single string, and copies it using navigator.clipboard.writeText().

Advanced Use Cases

This tool isn’t just for copying — it unlocks a variety of workflows:

・Quickly pasting an entire codebase into an LLM for inspection
・Pre-processing local files for use with a full-text search engine
・Reviewing folder structure and contents before documentation
・Validating file contents during pre-deployment (CI/CD) steps
・Creating a single “context string” to tell GPT:
  "Here's everything in this project — please summarize or answer questions."

With a single click, what was previously a pile of local files becomes rich, promptable text data.

Final Thoughts

That’s it — a simple but useful site for copying the names and contents of all files in a folder to your clipboard.

Once you try it, you might realize just how often you’ve wanted a tool like this to "just show me everything at once."

I hope this becomes a handy part of your workflow.
And if you find it helpful, I’d really appreciate it if you share it with others!

Thanks for reading 🙌

Notes

This article was polished using ChatGPT.
Apologies if you prefer human-only writing — I’m always open to feedback.

To be honest, I initially didn’t think this site would work, given how restrictive HTML and browser APIs can be.
But to my surprise, it actually works — and quite smoothly!

That said, please note that this feature might stop working in the future due to potential changes in browser specifications.
I appreciate your understanding in that regard.

Top comments (0)