I am hoping someone could help me out. I am using a script that when pointed at a certain file in a folder, will generate a JSON file in that same folder. Below is the command used to run the script which is currently done file by file.
bash /path/to/script/PageBuilder.sh "/path/to/file/cvinfo"
I am looking to inotifywait
to scan through the subdirectory and look for every cvinfo
file and execute the script on that file.
This is what I have tried so far with no luck:
psttern="cvinfo"
inotifywait -m -r -e close_write --format %w%f /mnt/m/Comics/ | while read FILENAME; do
if [[ "$FILENAME" == *${pattern}* ]]; then
bash /mnt/m/PageBuilder/PageBuilder.sh "$FILENAME";
fi
done&
This currently just sets up the watches and then nothing after that, even if the cvinfo
file is moved to and from the folder or edited etc.
My knowledge on any of this is purely from our friend Google so i only have a very basic knowledge of how this works. I've tried looking for other posts to help but none work for my problem.
I'm using Windows but running this in a BASH terminal.
inotify
has been made available under Windows only recently (Windows 10, don't know which patchlevel).