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.

 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";

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.

Thank you!

  • As I understood it, inotify has been made available under Windows only recently (Windows 10, don't know which patchlevel). – Ljm Dullaart Jul 5 '19 at 15:33
  • Did you ever have any luck with this? I've looked at inotifywait and can get it to run on a single diredtory but could never get it to scan directories and run recursively. with just inotifywait -qm --event modify --format '%w' "/mnt/b/Action Lab/Twin Worlds (2020)/cvinfo" I've tried your script but i keep getting a syntax error. – James Williams Jun 8 at 7:12
  • To be honest: no. I've never tried it recursively. – Ljm Dullaart Jun 8 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.