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

时间:2021-04-03 16:26:34

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.

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

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?

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

1 个解决方案

#1


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

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

find /folderpath -type l -delete

#1


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

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

find /folderpath -type l -delete