删除目录(树)中的所有链接(别名)
Remove all links (aliases) in a directory (tree)
我有一个目录目录,其中可能包含也可能不包含文件、其他目录或链接。
我想删除所有链接。有谁知道可以让我快速执行此操作的 bash 脚本吗?
google 搜索 查找目录中的所有链接 导致:
find . -maxdepth 1 -type l
您可以将其与 rm
结合使用:
rm `find . -maxdepth 1 -type l`
c.f。 this
如果你够勇敢,试试这个 -
find $dirPath -type l | xargs rm -f
我有一个目录目录,其中可能包含也可能不包含文件、其他目录或链接。
我想删除所有链接。有谁知道可以让我快速执行此操作的 bash 脚本吗?
google 搜索 查找目录中的所有链接 导致:
find . -maxdepth 1 -type l
您可以将其与 rm
结合使用:
rm `find . -maxdepth 1 -type l`
c.f。 this
如果你够勇敢,试试这个 -
find $dirPath -type l | xargs rm -f