Skip to main content

f2t2f

f2t2f (Folder to Text to Folder) is a command-line tool that converts entire folder structures—including all file content—into a single, portable text format. It's perfect for sharing projects, providing context to Large Language Models (LLMs), or creating project templates.

This tool is designed to be highly resilient, capable of parsing structured text from complex, conversational AI responses.

Installation

pip install f2t2f

Core Commands

Folder to Text

Use copy to send a project's structure to your clipboard or save to write it to a file.

Copy to clipboard:

# Copies the entire structure of ./my-project
f2t2f copy ./my-project

Save to a file:

# Saves the structure to a file named my-project.txt
f2t2f save ./my-project my-project.txt

Text to Folder

Use paste to apply changes from your clipboard or load to apply them from a file. The tool is smart enough to create new files, apply patches to existing ones, or build an entire project from scratch.

Create/patch from clipboard:

# Reads from the clipboard and applies changes to the current directory
f2t2f paste

Create/patch from a file:

# Reads from my-project.txt and applies changes to ./output-dir
f2t2f load my-project.txt ./output-dir

Filtering with .f2t2f

You can control which files and folders are included by creating a .f2t2f file in your project's root directory.

To create a configuration file:

# Creates a sample .f2t2f file in the current directory
f2t2f list init

This will create a file with type: blacklist and instructions. You can change the type to whitelist and add file paths, directory paths, or glob patterns (e.g., *.pyc, node_modules/) to either include or exclude them.


The Ultimate AI System Prompt

To get perfect, copy-and-paste results from an AI, give it the following system prompt. This prompt instructs the AI to use a format that f2t2f is built to understand, including its more resilient features.

You are an expert programmer. Your task is to help me with my project by providing code modifications.

You MUST format your entire response as a single block of text. You can include conversational text and explanations, but all code changes must be encapsulated in `f2t2f` format blocks. The tool I use is smart and will only parse the code blocks, ignoring any surrounding text.

**RESPONSE RULES:**

1.  **Create New Files with `file` blocks:** To create a new file, provide its full path and content.

    ```text
    >>> file: path/to/new_file.py
    print("This is a new file.")
    <<<
    ```

2.  **Modify Existing Files with `diff` blocks:** To modify a file, you MUST provide the changes as a standard **unified diff**. The diff MUST include the `--- a/path/to/file` and `+++ b/path/to/file` headers. My tool is smart enough to handle the correct file paths, even if they are nested.

    ```text
    >>> diff: path/to/existing_file.py
    --- a/path/to/existing_file.py
    +++ b/path/to/existing_file.py
    @@ -1,3 +1,4 @@
     line 1
    -line 2 (to be removed)
    +line 2 (the new line)
     line 3
    +line 4 (a new line)
    <<<
    ```

3.  **Encapsulation:** You can wrap the content of `file` or `diff` blocks in markdown code fences (e.g., ` ```diff `) if you need to. My tool will handle it automatically.

**EXAMPLE OF A PERFECT RESPONSE:**

Here is an example of a perfect response that creates one file and modifies another. I can copy this entire message, and my tooling will handle it flawlessly.

***

Of course! I can help with that. Here are the changes to implement the feature you requested. I've created a new utility file and modified the main application file to integrate it.

>>> file: src/utils.js
export function newUtil() {
  console.log("This is a new utility function.");
}
<<<
---
>>> diff: src/app.js
--- a/src/app.js
+++ b/src/app.js
@@ -1,3 +1,4 @@
+import { newUtil } from './utils.js';
 
 function main() {
-  console.log("Hello, old world!");
+  console.log("Hello, new world!");
+  newUtil();
 }
 
 main();
<<<

By following these instructions, you guarantee that I can use your response directly and efficiently.

License

MIT License © Vova Auer

Metadata

Release files for f2t2f 0.3.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for f2t2f 0.3.9
File Size Uploaded
f2t2f-0.3.9.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for f2t2f 0.3.9
File Interpreter ABI Platform
f2t2f-0.3.9-py3-none-any.whl Python 3 none any Details

Total release size: 29.3 kB

Release files / f2t2f-0.3.9.tar.gz

Download URL f2t2f-0.3.9.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ed72789581593c670a79b39a60d6a76cb511a6868ab682a5abc6dd1dc7d41aac
BLAKE2b-256 checksum
How to use checksums
b9d3d0657b4082c117fb09786033cd6f07f0dca9fbf20a553ef34bd87fe3da3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 24, 2025.

Transparency log

Release files / f2t2f-0.3.9-py3-none-any.whl

Download URL f2t2f-0.3.9-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abce0a574ef7ffee62730e4783d9521179bc0ce0a12fb58f37365031f9b1b92d
BLAKE2b-256 checksum
How to use checksums
40c2c7bec482bf39888f6d316a51f57d8479c710bcb8b8a15aedc890caea7d3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 24, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page