On 05.08.2021 11:56,
[email protected] wrote:
On Thursday, August 5, 2021 at 4:05:49 PM UTC+8, [email protected] wrote:
On Thursday, November 19, 2020 at 11:35:41 AM UTC+8, Janis Papanagnou wrote: >>> I want to inspect file status information and directory contents
by some watchdog tool; e.g. new files appearing in a directory or
a file update should be detected and indicated by an alert window.
This should work only on dedicated files or directories, say, by
calling the tool with the respective name and/or file attributes.
Before I'm going to write my own command line tool I'd be interested
if there's something like that already existing.
There is a very helpful discussion here:
https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes
Based on the suggestions given in the above discussion, I currently use the following code snippet:
In my case (the task behind the original post) it is something like
inotifywait -q -m -e create -e delete "${dir}" |
while read WHERE EVENT FILE
...check for file pattern and trigger a 'zenity' dialog...
i.e. triggering 'create' and 'delete' events on files matching a
specific pattern, and notifying about those events using 'zenity'.
('zenity' isn't optimal here, but each tool has it's drawbacks.)
Janis
inotifywait --quiet --monitor --event modify some-file-under-watch | while read change; do
do-something-here
done
HY
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)