Handy One-Liners
Find (and erase) all bad symlinks
Situation: You have a directory with a thousand files and a few dozen bad symlinks. How do you list just the bad symlinks?
find -L . -type l -name "*gz"
Of course, replace “*gz” with whatever file pattern you require, or use “*” to include everything.
To erase those bad links:
find -L . -type l -name "*gz" | xargs rm