Not without the slash. On a Mac, rm -rf project-link removes only the symbolic link (a small file that points to a folder), while rm -rf project-link/ deletes the folder it points to and every file in it, with no Trash and no Put Back. Checking for links before a delete, and keeping a backup, covers both cases.
One trailing slash deletes the folder
We made a folder with four empty files and a link to it:
% mkdir my-project
% touch my-project/{app.py,data.csv,notes.md,README.md}
% ln -s my-project project-link
Without the slash, only the link goes:
% rm -rf project-link
% ls my-project
README.md app.py data.csv notes.md
With the slash, the folder goes and the link stays (the @ marks a link), now pointing at nothing:
% 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
rm printed nothing and asked nothing. Leaving out -f (force) didn't change the result, and a second run on October 6 gave exactly the same result.
The slash makes the path follow the link
The slash changes what the path refers to. Under POSIX (the path rules macOS follows), a link at the end of a path refers to the link itself only when no slash follows it. With the slash, the system follows the link, so project-link/ means my-project, and rm deletes what it was given. On macOS, that means the folder itself, not just the files inside it.
For a real folder the slash makes no difference: rm -rf my-project and rm -rf my-project/ both delete it. It only matters when the last part of the path is a link.
Python and Swift do the same
Apple's Python (/usr/bin/python3, 3.9.6) refused to delete the link without a slash, but deleted the folder once the slash was added:
% /usr/bin/python3 -c "import shutil; shutil.rmtree('project-link')"
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
Homebrew's Python 3.14.5 deleted the folder on the second call too. In a small Swift program, FileManager.default.removeItem(atPath:) removed just the link for project-link and the folder with its files for project-link/.
None of these use the Trash, and the Mac's file system (APFS) has no undelete. What reliably brings files back is a backup.
The path decided, not the walk
On September 21, 2026, Cybersecurity News reported that Claude Code, an AI coding agent, deleted 48,218 live project files in 103 seconds on Windows. The figures come from the user's own account, and the article calls the deletion alleged. A cleanup script went through an old mirror of the project folder by folder, set not to follow links, but the mirror held 614 Windows directory junctions pointing back into the live project, and Windows doesn't report a junction as a link. So the walk went in.
On the Mac, Python's folder walk (os.walk('.', followlinks=False)) held up: it listed project-link as a folder and stayed out of it. What decided the outcome was the path passed to the delete command.
If an agent runs commands on your Mac
An agent with a terminal can type rm -rf like anyone else, and here one character was the difference between deleting a link and deleting a folder. These habits help:
- Before deleting a folder, run
find my-project -type l, with your folder in place ofmy-project. It lists every symbolic link inside and changes nothing. - Set up a backup once: System Settings > General > Time Machine > Add Backup Disk. With a backup disk, Time Machine also keeps local snapshots on the Mac, about one an hour for 24 hours (Apple's article; our guide to local snapshots explains why they count in System Data).
Check your Mac
This command is read-only and 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
With a Time Machine disk set up, the first line should name the disk and the last should show the latest backup. We haven't seen that output ourselves. Run tmutil listlocalsnapshots / on its own to see the snapshots' names.
Changed items stay, with the reason
Mint deletes files too, so it records what each item is without following links and checks it again just before removing it. If a link now sits where a folder was, or a folder where a link was, Mint keeps the item and tells you why. Files you pick in Yours 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.
What it means
On a Mac, a trailing slash silently turns "remove this link" into "remove everything it points to", in the shell, in Python and in Swift. You can't control every path an agent types, but you can check for links before deleting and make sure a backup exists before an agent gets a terminal.
Data: one Mac running macOS 27.0.1 (26A434), tested on October 4, 2026 and again on October 6, with a fresh folder of four empty files and a link before each delete, in zsh 5.9. We didn't reproduce the Windows case, and we haven't tested a restore from a local snapshot.