已关闭此问题为not about programming or software development。它目前不接受回答。
这个问题似乎不是关于a specific programming problem, a software algorithm, or software tools primarily used by programmers的。如果你认为这个问题与another Stack Exchange site的主题有关,你可以留下评论,解释在哪里可以回答这个问题。
上个月关门了。
Improve this question
我有一个目录包含几个子目录:
./abc/
./cde/
./link_to_abc -> ./abc
abc和cde是普通目录,而link_to_abc是一个目标为abc的软链接。
现在我想使用Linux的find命令来查找没有软链接的普通dir,在我的例子中,它是cde。怎么做?
因为我需要删除一些目录,但我应该检查没有人使用我的文件了(没有其他符号链接指向我的目录)
3条答案
按热度按时间hkmswyz61#
以下解决方案使用多个
find
,但应该可以工作:txu3uszq2#
使用
find ! -type l
或find -type d
检查此答案https://stackoverflow.com/a/16303559/3343045
ef1yzkbh3#
如果只有一个符号链接要排除,请使用以下方法:
这将查找
/dir
下的所有文件夹,指定符号链接指向的文件夹除外。