删除原始文件夹时删除符号链接

发布于 2024-07-27 05:16:50 字数 140 浏览 4 评论 0原文

我正在考虑使用 inotifywait 来查看原始文件夹所在的原始文件夹,然后每当它检测到某个文件夹已被删除时,就删除另一个文件夹中相同的符号链接。

所以我的问题是,这是最好的方法吗? 或者当原始文件夹被删除时是否有更好的方法来删除符号链接?

I was thinking of using inotifywait to watch the original folder where the original folders are in, then whenever it detects that a folder has been deleted, then delete the same symbolic link in the other folder.

So my question is, is that the best way? Or are there better ways to delete a symbolic link when the original folder gets deleted?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥有 2024-08-03 05:16:50

我没有使用过inotify,但是如果它可以集成*nix的find命令,你可以用它来删除链接

find /folderpath -type l -delete

i have not used inotify, but if it can integrate *nix's find command, you can use it to delete the link

find /folderpath -type l -delete
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文