M
MafLabs
Developer Tool Runs in your browser. Nothing is uploaded.

Extract Files from AI Replies: Code Blocks and File Paths

Paste any ChatGPT, Claude, DeepSeek, or Gemini response. Automatically parse filenames, review folders, and download a ready-to-use ZIP.
Paste the AI Reply 0 chars · 0 lines
Drop markdown or text file here
Files Found 0 blocks · 0 files · 0 lines
No code blocks detected yet. Paste an AI reply or load a sample to view files.

Extract Files and Folder Structures from AI Answers Instantly

Modern Large Language Models (LLMs) like ChatGPT (GPT-4o), Anthropic Claude 3.5 Sonnet, DeepSeek-V3, and Google Gemini excel at generating full project code bases. However, working with multi-file answers is tedious: developers are forced to manually create nested folders, create empty files, scroll through long responses, and copy-paste each markdown code snippet individually.

AI Reply to Files is a dedicated developer utility designed to eliminate that friction. By pasting the complete AI markdown conversation into this browser-based tool, you can automatically parse, sanitize, preview, and download all code blocks as a structured ZIP file with clean directory hierarchies—in under a second.

How to Use: 5 Simple Steps

  1. Copy the full AI reply: Highlight or click "Copy" on your ChatGPT, Claude, or DeepSeek conversation output.
  2. Paste into the left editor: Insert the markdown into the workspace. The tool parses code fences automatically with a 250ms debounce.
  3. Review detected files and paths: Inspect the hierarchical file tree in the right pane. File paths and languages are recognized automatically.
  4. Adjust filenames or code: Click any file in the tree to edit its relative folder path, programming language, or inline source code.
  5. Download your ZIP: Click Download ZIP to produce an archive matching your project's exact folder structure.

Before and After Comparison

Before: Raw AI Markdown Reply
Here is the implementation:

### src/services/auth.ts
```typescript
export function login(user: string) {
  return { token: "secret_jwt" };
}
```

Next, in `components/UserProfile.tsx`:
```tsx
export const Profile = () => <div>Hello</div>;
```
After: Downloaded ZIP Archive
project.zip
├── src/
│   └── services/
│       └── auth.ts
├── components/
│   └── UserProfile.tsx
└── REPLY.md (optional backup)

How the File Path Parser Works

Different AI models and prompting styles present file names in varied ways. To achieve optimal extraction accuracy, our deterministic parser tests each code block against four descending tiers:

Built-In ZIP-Slip and Path Traversal Protection

When extracting files from arbitrary text, security is paramount. Malicious or hallucinated code blocks could potentially attempt path traversal attacks (such as ../../../../etc/passwd or Windows drive letters like C:\Windows\System32).

Our path sanitizer neutralizes these threats before building the archive:

Common Problems & Edge Cases Handled

Real-world AI replies frequently contain syntax anomalies that cause standard parsers to fail:

Frequently Asked Questions

How do I extract files from an AI reply?
Simply paste the full markdown response from ChatGPT, Claude, DeepSeek, or Gemini into the left input pane. The tool immediately scans all code blocks, recognizes target file paths and languages, organizes them into a folder hierarchy, and lets you download a clean .zip package with a single click.
How do I get the file paths from an AI answer?
The tool uses a 4-tier detection algorithm: 1) Info-string attributes like ```js title="src/app.js", 2) First-line comments like // components/Header.jsx or # main.py, 3) Preceding markdown lines like 'In `utils/math.ts`:', and 4) Smart language fallback mappings (snippet-1.py, snippet-2.ts).
How do I save multiple files from a ChatGPT answer?
Instead of manually creating folders and copy-pasting code blocks one by one, paste the conversation into this tool. Review the detected directory tree in the right pane, toggle whichever files you need, and click 'Download ZIP'. All folders and filenames are created automatically.
How are file names detected?
File names are evaluated in priority order: first from code block info strings (e.g. ```typescript filename=src/index.ts), next from top-line code comments, third from neighboring prose headings or bold path tags, and lastly through language-keyed sequential fallbacks.
Is the code run?
No, never. The tool is strictly a static text parser and ZIP builder. No code is evaluated, executed, rendered in an iframe, or sent through eval. Shell commands can optionally be collected into a safe script file for reference.
Is my reply uploaded?
No. Everything runs 100% locally in your web browser using vanilla client-side JavaScript. There are no server uploads, no remote telemetry, and no AI API calls. You can even run this page entirely offline.

Related Free Developer Tools by MafLabs

Discover more private, browser-based developer utilities designed to make web development and data processing effortless: