Created
May 7, 2020 20:50
-
-
Save rogersguedes/dc3440e4df588e0964df1b5e891dcf86 to your computer and use it in GitHub Desktop.
sample script that shows how to use `inotifywait` result in a shell script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Thanks to https://unix.stackexchange.com/questions/24952/script-to-monitor-folder-for-new-files | |
inotifywait -m . -e create -e moved_to | | |
while read dir action file; do | |
echo "The file '$file' appeared in directory '$dir' via '$action'" | |
# do something with the file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment