- The problem. A user said Claude Code deleted 48,218 live project files in 103 seconds on Windows, after a script walked into 614 directory junctions.
- What we found. On macOS 27, rm -rf project-link removed only the link. With one trailing slash it deleted the folder and its four files, and nothing went to the Trash.
- What we built. Mint records each item without following links and checks again before removing it. If a link and a folder have swapped, it keeps the item and says why.
Not without the slash. On a Mac, rm -rf project-link removes the symbolic link and leaves the folder it points to alone. With one slash at the end, rm -rf project-link/ deleted that folder and all four files in it, and the link stayed where it was. Python's shutil.rmtree and Apple's FileManager also delete the folder once the path ends in a slash. None of it goes through the Trash.
The commands and their output are below. At the end there's a one-line, read-only check for whether your Mac could get deleted files back.
What happened on Windows
On September 21, 2026, Cybersecurity News reported that Claude Code, an AI coding agent, deleted 48,218 live project files in 103 seconds, from 10:10:31 to 10:12:14 p.m. ET. Those figures come from the user's own account, and the article calls the deletion alleged.
The agent was clearing out an old mirror of the project with a Python script, which walked the mirror with os.walk(..., followlinks=False) so that it wouldn't follow links. But the mirror held 614 Windows directory junctions pointing back into the live project, and on Windows os.path.islink() returns False for a junction. The walk took each junction for an ordinary folder and went in. According to the report, the project's Git object store was emptied as well.
We didn't try to reproduce the Windows case. What we wanted to know was how links behave on a Mac.
The test
On October 4 we used a Mac running macOS 27.0.1 (26A434). In zsh 5.9, inside a scratch folder, we made a folder with four empty files and a symbolic link to it:
% mkdir my-project
% touch my-project/{app.py,data.csv,notes.md,README.md}
% ln -s my-project project-link
Deleting the link:
% rm -rf project-link
% ls -F
my-project/
% ls my-project
README.md app.py data.csv notes.md
Only the link went. my-project and its files were still there. We made the link again and added a slash:
% ln -s my-project project-link
% rm -rf project-link/
% ls -F
project-link@
% ls my-project
ls: my-project: No such file or directory
This time my-project and its four files were gone, and project-link was still there, pointing at a folder that didn't exist anymore. rm printed nothing and asked nothing. Leaving out -f didn't change the result, and a second run on October 6 printed exactly the same.
Why one slash changes it
The slash changes what the path refers to. POSIX path resolution treats a symbolic link at the end of a path as the link itself only when no slash follows it. With the slash, the system resolves the link, so project-link/ refers to my-project, and rm deletes what it was given. It removes the files inside, and on macOS it removes the folder as well.
The walk itself held up on the Mac. On October 6, os.walk('.', followlinks=False) listed project-link as a folder and stayed out of it. What decided the outcome was the path passed to the delete.
Python and Swift
Apple's /usr/bin/python3 (3.9.6, from the developer tools), on a fresh copy of the folder:
% /usr/bin/python3 -c "import shutil; shutil.rmtree('project-link')"
Traceback (most recent call last):
...
OSError: Cannot call rmtree on a symbolic link
% /usr/bin/python3 -c "import shutil; shutil.rmtree('project-link/')"
% ls my-project
ls: my-project: No such file or directory
Without the slash, rmtree refuses. With it, it deletes my-project without a word. Homebrew's Python 3.14.5 deleted the folder on the second call too. Its first call failed with a different message, OSError: [Errno None] None: 'project-link'.
Then Foundation, from a small Swift program. FileManager.default.removeItem(atPath:) removed just the link when given project-link, and the folder with its files when given project-link/. The link survived.
No Trash, no Put Back
rm, shutil.rmtree and removeItem delete files on the spot. They don't use the Trash, so there's no Put Back, and APFS has no undelete. Recovery apps exist, but we haven't tested any. What reliably brings files back is a backup.
The test Mac had no backup
Our test Mac, on October 4:
% tmutil listlocalsnapshots /
Snapshots for disk /:
% tmutil destinationinfo
tmutil: No destinations configured.
No local snapshots and no backup disk, and nothing had changed by October 6.
Apple's article on local snapshots says Time Machine also keeps backups on the Mac itself. It saves a snapshot of the startup disk about every hour and keeps each one for 24 hours, plus one of the last successful backup until the space is needed. With no backup disk set up, this Mac had none of them. Our guide to Time Machine snapshots explains what they are and why they're counted in System Data.
If an agent runs commands on your Mac
An agent with a terminal can type rm -rf like anyone else, and in this test a single character was the difference between deleting a link and deleting a folder. How often agents end a path with a slash, we don't know. The part you control is the backup, and you set it up once: System Settings > General > Time Machine > Add Backup Disk. It's worth doing before an agent gets a terminal on your Mac.
Check your Mac
The line below only reads, and it doesn't ask for a password. Paste it into Terminal as one line:
d=$(tmutil destinationinfo 2>&1); n=$(tmutil listlocalsnapshots / 2>/dev/null | grep -c 'com.apple'); l=$(tmutil latestbackup 2>/dev/null | sed 's#.*/##'); echo "Backup disk: $(echo "$d" | grep -q 'No destinations' && echo none || echo "$d" | awk -F' *: ' '/^Name/{print $2; exit}')"; echo "Local snapshots: $n"; echo "Latest backup: ${l:-none}"
Ours printed:
Backup disk: none
Local snapshots: 0
Latest backup: none
We ran it in zsh 5.9 and in the bash 3.2 that ships with macOS. With a Time Machine disk set up, the first line should name the disk and the last should show the latest backup, but we haven't seen that output ourselves. The number in the middle counts the snapshots tmutil listlocalsnapshots / lists; run that on its own to see their names.
What Mint does
Mint is a Mac storage app, so it deletes files too. When it lists something, it records that item itself without following links, and it checks again just before removing it. If a link now sits where a folder was, or a folder where a link was, Mint keeps it and tells you why. Files you pick in Yours can go to the Trash, where Mint's Undo can put them back. Caches and build output in Safe to clean are deleted outright. Mint doesn't make backups and is no substitute for Time Machine.
Questions
Can rm -rf delete the folder without the slash? It didn't in any of our runs. Without the slash, only the link went.
Does the slash matter for a normal folder? No. rm -rf my-project and rm -rf my-project/ both delete a real folder. The slash only matters when the last part of the path is a link.
How can I see the links in a folder before deleting it? Run find my-project -type l. It lists every symbolic link inside and changes nothing. In our scratch folder, find . -type l printed ./project-link.
Would a local snapshot have saved the files? Apple says Time Machine can restore files from local snapshots when the backup disk isn't connected. We haven't tried a restore, and our test Mac had no snapshots to try with.
Is this a macOS bug? Resolving the link when the path ends in a slash is what POSIX specifies. Whether the folder itself goes at the end may vary between systems; on macOS it did.