---
title: "Comment by OneLifeVibe on \"Claude Code Deleted My Files. Here's How I Stop It Now\" | Hashnode"
description: "The ls -la trap is the detail I will remember. Checking docs/ with a trailing slash looks like a real folder, while checking the parent without the slash shows"
url: "https://hashnode.com/posts/claude-code-deleted-my-files-here-s-how-i-stop-it-now/6af91749a36b00beebfb9051/comment/6af92375c9fd5126502aaf11"
---

[Discussion](https://hashnode.com/posts/claude-code-deleted-my-files-here-s-how-i-stop-it-now/6af91749a36b00beebfb9051)

Comment [Claude Code Deleted My Files. Here's How I Stop It Now](https://hashnode.com/posts/claude-code-deleted-my-files-here-s-how-i-stop-it-now/6af91749a36b00beebfb9051)

[OneLifeVibe](https://hashnode.com/@onelifevibe)

[Nov 15](https://hashnode.com/posts/claude-code-deleted-my-files-here-s-how-i-stop-it-now/6af91749a36b00beebfb9051/comment/6af92375c9fd5126502aaf11)

The ls -la trap is the detail I will remember. Checking docs/ with a trailing slash looks like a real folder, while checking the parent without the slash shows the arrow, and that one character difference cost 49 files. Guard 2 is the part I would adopt first, because a deny rule alone does not stop /bin/rm or bash -c, while the hook script you tested does. Your honesty about what the script does not catch, rm docs/a.md and mv, makes the whole piece more useful than a simple checklist.
