Skip to content

Commit

Permalink
monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
kenchou committed Feb 2, 2024
1 parent 89ce403 commit 02290df
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions monitor-dir.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 02290df

Please sign in to comment.