Deleting a symbolic link or junction on Windows is not the same as deleting a regular folder — and using the wrong command will remove the target data, not just the link. This is one of the most common and silent mistakes when working with mklink. This article explains the correct commands for each link type, what happens when you use the wrong one, and how to verify the result.
Quick answer
:: Remove a directory symbolic link or junction — does NOT delete target data
rd "C:\LinkedFolder"
:: Remove a file symbolic link — does NOT delete target file
del "C:\Linked\report.txt"
rmdir /S or rd /S on a junction or directory symlink will recursively delete the target directory and all its contents. The link is removed, but the real data is gone too.
What actually happens when you delete a link
A symbolic link and a junction are filesystem entries that point to another location. When you delete the link entry itself, the target is untouched. The data continues to exist at its real path.
The problem is that some deletion methods do not treat links as link entries — they follow the pointer and operate on the target. This is the default behavior of rmdir /S, File Explorer’s Delete key in certain situations, and some third-party tools.
| Method | Link type | Removes link? | Removes target data? |
|---|---|---|---|
rd "C:\Link" | Directory symlink / Junction | ✓ | — |
rd /S "C:\Link" | Directory symlink / Junction | ✓ | ✓ dangerous |
del "C:\Link\file.txt" | File symlink | ✓ | — |
| File Explorer → Delete | Directory symlink / Junction | ✓ usually | — usually, but varies |
| File Explorer → Delete | Junction (older Windows) | ✓ | ✓ in some versions |
How to delete each link type correctly
1. Directory symbolic link (mklink /D)
Use rd without the /S flag. The /S flag means “recursive” — it will follow the link into the target directory and delete everything there.
:: Removes only the symlink entry — target folder is untouched
rd "C:\LinkedFolder"
C:\LinkedFolder is removed. The real folder at its target path remains intact.
2. Directory junction (mklink /J)
Same command as for directory symlinks. rd without /S removes the junction entry only.
:: Removes only the junction entry — target folder is untouched
rd "C:\OldApp\Config"
3. File symbolic link (mklink without switch)
Use del. This removes the link file entry. The target file is not affected.
:: Removes the file symlink — target file remains
del "C:\Linked\report.txt"
4. Hard link (mklink /H)
Hard links behave differently. Because both paths point to the same underlying file data, deleting one path removes that directory entry — but the data remains accessible via the other path. The file is only truly deleted when all hard links to it are removed.
:: Removes this path entry — file data remains until all hard links are deleted
del "C:\Shared\latest.log"
fsutil hardlink list "C:\App\output.log". The data is deleted only when the last link is removed.
How to verify before deleting
Before running any deletion command, confirm the path is actually a link and not a real directory. Use dir /AL to list all symbolic links and junctions in a folder.
:: List symlinks and junctions in the current directory
:: Output will show <SYMLINK>, <SYMLINKD>, or <JUNCTION> next to link entries
dir /AL
Example output:
25/03/2026 10:14 <JUNCTION> Config [D:\AppData\ConfigFiles]
25/03/2026 10:15 <SYMLINKD> LinkedFolder [D:\RealFolder]
25/03/2026 10:16 <SYMLINK> report.txt [D:\Data\report.txt]
The brackets show the target path. If you see <JUNCTION>, <SYMLINKD>, or <SYMLINK> — the entry is a link, not real data. Safe to delete with rd or del.
dir /AL shows nothing for a path you expected to be a link, it may be a real directory. Do not delete it without checking further.
PowerShell equivalent
In PowerShell, use Remove-Item without the -Recurse flag to remove a link safely.
# Remove a directory symlink or junction — no -Recurse flag
Remove-Item "C:\LinkedFolder"
# Remove a file symlink
Remove-Item "C:\Linked\report.txt"
Remove-Item -Recurse "C:\LinkedFolder" will follow the link and delete the target directory contents, just like rd /S. Never use -Recurse when removing a symlink or junction.
Tips and limitations
- Always use
dir /ALto confirm a path is a link before deleting - Never use
rd /SorRemove-Item -Recurseon symlinks or junctions - File Explorer is generally safe on Windows 10/11 but unreliable across all Windows versions — prefer the command line for consistent behavior
- Deleting a junction or symlink does not require administrator rights in most cases — creating one does
- After deleting a link, the path simply disappears. The target data stays at its real location.
Official reference
mklink — Windows Commands | Microsoft Learn
Related guides
- mklink in Windows: symlinks, junctions, and when to use each
- How to list all symbolic links on Windows — coming soon
- NTFS hard links vs symbolic links vs junctions — coming soon
- Base64 encoding in PowerShell: encode and decode files and strings
