Skip to main content
DanManREAL/ AI_LAB
Updated Nov 20, 2026Request a test

AI tools4 min readBy Published Updated

Claude Code deleted my files: how to get them back

In this guide

The short version

  • Stop the session first, and do not ask the assistant to fix it until you know what happened.
  • Claude Code's rewind tracks edited files, but shell-only changes and deletions may require Git or backups.
  • Check version history, the Recycle Bin, cloud folders and backups before you keep working.
  • A version history and a check before risky actions limit what any mistake can cost.

Guide

4 min read
Illustration of a folder being searched with a life buoy and a shield

If you let an AI coding assistant work on real files, this can happen: you ask for a tidy-up, and a minute later a folder is gone. Take a breath. What you do next can affect your chances of recovery.

This guide covers where deleted files can still be, what Claude Code's rewind (its built-in save points you can go back to) can and cannot restore, and how to reduce the risk of losing work again.

First, stop and look

Stop the session before anything else changes. A session is one sitting of work with the assistant. Do not ask it to undo what it did until you know what happened: a confused fix can overwrite the very files you want back.

  1. Stop Claude Code from taking any more actions: press Esc once to interrupt it, or close the window.
  2. Write down which files or folders are missing, and roughly when they disappeared.
  3. Scroll back through the conversation and find the step where the files went. How they were removed decides where to look.

What rewind can and cannot bring back

Claude Code saves a snapshot of the files it edits before each message you send. To go back to one, press Esc twice in an empty message box to open the rewind menu, pick the message that started the work you want undone, and choose Restore code (that means your project's files). Undo Claude Code changes walks through it step by step.

Rewind has limits that matter here. It covers changes Claude Code makes inside files with its own editing tools. Files changed only through Bash commands are not initially tracked. However, if Claude Code already edited a file with its own editing tools in this session, rewind can also undo later Bash changes to that tracked file. Deletions and moves done through shell commands, and edits in other sessions, are not reliably recoverable through rewind. Anthropic, the company behind Claude Code, says plainly that these save points are not a replacement for a proper version history.

Good to knowIf the conversation shows Claude Code editing or rewriting a file, rewind may bring it back. If it shows a file being deleted or moved through a shell command, go straight to the next section.

Where deleted files can still be

Work down this list before you keep working in that folder. The less that changes on your computer, the better your chances.

  • Your project's version history. If the project uses version control (a system that keeps every version of the project you choose to save), a deleted file usually comes back from the last saved version. Ask whoever set it up, or ask Claude Code once you know what happened, to restore just that file.
  • The Recycle Bin or Trash. Files removed by a program usually skip it, but it takes ten seconds to check.
  • Cloud folders. If the project sits in Dropbox, OneDrive, Google Drive or iCloud Drive, their websites keep deleted files, and often older versions, for a while.
  • Your computer's backup. Time Machine on a Mac and File History on Windows can bring back a folder as it was earlier, if they were turned on.
  • Your editor. Some editors, such as VS Code and Cursor, keep a local history of files you worked on in them. Look for a history or timeline view.

If nothing turns up

Some deletions are permanent. A file that was never saved anywhere else, removed by a program, with no version history and no backup, is usually gone. Recovery software can sometimes find deleted files on a drive, but the odds fall as the computer keeps writing new data, and on many modern drives they are poor from the start.

That is not the answer anyone wants. It is the reason the next section matters more than this one.

How to stop it happening again

  • Keep a version history. Ask Claude Code to turn on version control for any project you care about, and to save a version before each big request. Files included in that saved version can then be restored.
  • Keep Claude Code asking before it acts. It has settings for how much it asks before it runs things. On real projects, choose one that asks you first, and read each request before you say yes.
  • Write down what must never be touched. A short page of house rules the assistant reads first helps a lot. I explain how in Keep your AI coding assistant on track.
  • Put a check in front of risky actions. GIT_REAL, the free tool I built, is one such check.

GIT_REAL works on projects that use version control. You or your assistant can ask it what one exact action, such as deleting new files or going back to an older version, would put at risk. It answers with a clear allow or block and the reasons. It does not run the action itself.

It is free. It is advice rather than a lock: it helps when your assistant is told to check it first, or when you turn on its optional check. It is not a backup, so keep your version history too.

Try thisTry your setup on a practice copy of a project first. Delete a file on purpose and make sure you can get it back before you trust it with real work.

Common questions

What should I do first if Claude Code deleted my files?

Stop the session before anything else changes: press Esc once to interrupt it, or close the window. Do not ask it to undo what it did until you know what happened, because a confused fix can overwrite the very files you want back.

Can Claude Code's rewind bring back deleted files?

Usually not. Rewind covers changes Claude Code makes inside files with its own editing tools. Files changed only through Bash commands are not initially tracked. However, if Claude Code already edited a file with its own editing tools in this session, rewind can also undo later Bash changes to that tracked file. Deletions and moves done through shell commands, and edits in other sessions, are not reliably recoverable through rewind.

Where can files deleted by Claude Code still be?

Check your project's version history, the Recycle Bin or Trash, cloud folders such as Dropbox, OneDrive, Google Drive or iCloud Drive, your computer's backup, and your editor's local history.

How do I stop Claude Code deleting my files again?

Keep a version history and save a version before each big request, keep Claude Code asking before it acts, write down what must never be touched, and put a check in front of risky actions.

Next step

Put a check in front of risky actions

GIT_REAL is free and open source. Ask it about a risky action, such as deleting new work or going back to an older version, and it shows you and your AI coding assistant what that action would put at risk.

Keep reading