Removing Broken Symlinks

Published on June 18, 2022 | Tags: zsh TIL

Today, I was looking for a way to delete all broken symlinks from a directory. And the anaswer I found was much better than I expected. I use ZSH as my shell and this was the answer:


rm -- *(-@D)

which is amaxing! For a detailed explanation of how this works check out the Stack Overflow link below.


Ref.: https://stackoverflow.com/a/22099005


Ferran Jovell