Search code examples
bashrmln

Remove all links (aliases) in a directory (tree)


I have a directory of directories which may or may not contain files, other directories or links.

I want to delete all the links. Anyone know of a bash script that would let me do this quickly?


Solution

  • A google search to find all links in a directory leads to:

    find . -maxdepth 1 -type l
    

    You can combine this with rm:

    rm `find . -maxdepth 1 -type l`