One-Click Folder Flattener is a dead simple client-side, private, web-based tool designed to simplify the process of recursively taking a directory and flattening all the files to a single folder without losing context. It was originally made to lessen the burden of having to navigate directories to add files to ChatGPT and Claude. It flattens your project file structure while preserving file relationships through prepending the directory location to the file name. Technically you have to select your files THEN it is one click. GitHub repositories can be pulled similarly in a single click with an optional access token. This project uses to ShadCN, Tailwind, Next.js and React to simplify other people's submissions.
One-Click Folder Flattener processes your project structure, whether it's from local files/directories or a GitHub repository, and creates a flat structure where all files are in a single directory. The original file paths are placed into the new file names to preserve the structure information. The web app is single, static site executing client-side. All file and directory information stays local, including the ZIP process. You may optionally enter a GitHub token to avoid aggressive rate limiting.
[!NOTE] GitHub rate limits unauthenticated API calls by IP address to 60/hour. If you add a token, you get 5,000 per account. Check the GitHub Integration and Privacy section for more info.
Here's an example of how the flattening process works for an added directory:
Original Structure:
myproject/
├── src/
│ ├── components/
│ │ ├── Header.tsx
│ │ └── Footer.tsx
│ ├── pages/
│ │ ├── index.tsx
│ │ └── about.tsx
│ └── styles/
│ └── main.css
└── README.md
Flattened Structure:
myproject::src_components::Header.tsx
myproject::src_components::Footer.tsx
[...]
myproject::README.md
Here's an example of how the flattening process works for a github repo (https://github.com/f/awesome-chatgpt-prompts in this case):
Original Structure:
awesome-chatgpt-prompts/
├── .github/
│ ├── FUNDING.yml/
│ ├── contentcodex.png
...
Flattened Structure:
awesome-chatgpt-prompts::.github::FUNDING.yml
awesome-chatgpt-prompts::.github::contentcodex.png
...
Key points about the flattening process:
Directories and Git Repositories: The relative path is added to the filename, with directory separators replaced by slashes. This preserves the project structure information.
Individual Files: When a single file is uploaded (not part of a directory or repository), it retains its original filename without any path information. This is a browser security consideration, to avoid exposing potentially sensitive information about the user's file system structure.
GitHub Repositories: Files from GitHub repositories are treated similarly to local directories. The repository name and relative path within the repository are included in the flattened filename.
This flattening process applies identically to both local files/directories and files fetched from GitHub repositories. The tool ensures that the original file structure can be inferred from the new file names, allowing Claude.ai to understand the context and relationships between files, while maintaining user privacy and security.
The flattening process involves these steps:
To set up the File Flattener locally, follow these steps:
# Clone the repository
git clone https://github.com/shacthulu/one-click-folder-flattener.git
# Navigate to the project directory
cd one-click-folder-flattener
# Install dependencies
npm install
# Start the development server
npm run dev
Adding Files:
GitHub Integration:
File Management:
Flattening:
Downloading:
Using with Claude.ai:
To use the GitHub integration feature:
repo
scope.The File Flattener for Claude Projects offers GitHub integration to allow users to easily fetch and flatten files from GitHub repositories. Here's what you need to know about using this feature:
GitHub Token:
Token Scopes:
public_repo
scope.repo
scope.Generating a Token:
Token Storage and Privacy:
Application Privacy:
Security Considerations:
By using a GitHub token, you can avoid rate limiting issues and access private repositories if needed. Remember that the File Flattener is designed with privacy in mind, processing everything locally and never sharing your data or tokens with external services. GitHub's limitations are as follows:
Unauthenticated (i.e. no token) calls are:
Authenticated calls are:
We welcome contributions to the One-Click Folder Flattener project! Please follow these steps:
git checkout -b feature/your-feature-name
git commit -m 'Add some feature'
git push origin feature/your-feature-name
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Project Link: https://github.com/shacthulu/one-click-folder-flattener
If you have any questions or feedback, please open an issue on GitHub or contact the maintainers directly.
[!NOTE] We want to keep this as simple as possible for the 99% of users so advanced options will need to be easily accessible, yet tucked away. We want your grandma to have this in her bookmarks.
Made with ❤️ by [ShaCthulu]