diff --git a/monitor-dir.sh b/monitor-dir.sh new file mode 100755 index 0000000..b9f4c4a --- /dev/null +++ b/monitor-dir.sh @@ -0,0 +1,12 @@ +#!/bin/bash +if [[ -z $1 ]]; then + echo "Usage:" $(basename $0) "[PATH...]" + exit 1 +fi + +BIN_PATH=$(dirname $0) +inotifywait --exclude '(.tmp)' -r -me moved_to "$@" | while read dir action file; do + echo "The file '$file' appeared in directory '$dir' via '$action'" + # do something with the file + ${BIN_PATH}/file-clean-rust --prune "${dir}/${file}" +done