My mission is to check if someone changed my directory. I have path to the directory. In the first time I need to print "hello", and on the following times I need to check if there are files that deleted or created between this call to the path and the last time. If files are changed I need to print message: "file ____ created" or "file _____ deleted" (change name is equal to delete and create other file).
closed as unclear what you're asking by countermode, HalosGhost, dr01, Jeff Schaller♦, Eric Renouf Nov 11 '16 at 15:02
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
You could use the following command for inspecting files creation and deletion:
~/bin/notify.sh echo "hello"
from the following script based on
#!/usr/bin/env bash # file: bin/notify.sh <cmd> DIR=. ACTION=$(echo "%f_____ %e") "$@" while inotifywait -qre create -qre delete --format "$ACTION" $DIR do "$@" done