1

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?

Sam
  • 7,252
  • 16
  • 46
  • 65
Mint
  • 14,388
  • 30
  • 76
  • 108

1 Answers1

1

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
ghostdog74
  • 327,991
  • 56
  • 259
  • 343