I am trying to write a script and I am pretty new at this. So I think I will need some suggestions and advice.
I want to write a very small, fast and lightweight script to monitor a directory tree (including sub directories and files) for changes. This could be new files, files being deleted or changes to a file. Changes in this directory will have to trigger another script to run.
Ways I have found of doing this are by using ls, find or rsync to periodically check for changes while running in a loop
What would be the most efficient way of doing this? I would be grateful if you could maybe write a little bit of example code.