joh / when-changed

Execute a command when a file is changed
Other
1.21k stars 107 forks source link

Wait for "Steady-State" before action? #93

Open Jeppedy opened 1 year ago

Jeppedy commented 1 year ago

I'm watching for new files, but they are written to over a long period (20 minutes). Does the tool have a check for file size steady-state, or a period of time the file has to be done changing before it triggers the action?

joh commented 1 year ago

Hmm, unfortunately no, the tool does not have such a feature. A somewhat related feature is the -1 flag, which ensures long-running commands are not re-run if a file changes while the command was running.

You could, of course, add such functionality as a bash script which would keep track of the file size of each file and not run the command until the file size hasn't changed for a given number of time.

Or even better, if you would like to add it and submit a PR, such a feature would be a welcome addition to when-changed :)