Watch files for changes
Can anyone suggest an utility and/or and ARexx script to monitor a file for changes and eventually trig some events? Aminet didn't help me...
thanks! |
What do you mean by monitor and what kind of changes exactly? With ARexx you can use STATEF() to compare file size, protection flags, time stamp and comment. Or you use checksum to compare. Should it work only while the program or script is running or does it need a database to compare with?
|
When a file is changed by any other program, so I guess timestamp is good.
I'll give a try to the AX command, thanks! |
dos.library has a function to get notified when a file is changed. IPrefs uses it for example to update prefs when a prefs editor exits with Use or Save.
But I am not aware of a utility which allows general use of this function. It shouldn't be too difficult to write one, though. |
It seems RMH (RexxMustHave http://aminet.net/package/util/rexx/rmh ) library contains notify functions that can be used for files. Yes, there is also an example notify.rexx.
|
daxb suggestion turned out to be of great value, with the power of ARexx do what I needed was as simple as this:
Code:
/* watch a file and execute it, useful to test code compiled externally */ |
The problem is the "stupid" endless loop that has to be used. I would at least DELAY() the loop to save some CPU time. I've never tried but the RMH notify seems to be a better way:
Code:
/* |
Thanks, I agree. But when I'm executing this I'm basically waiting for some code to be compiled into the "J" executable which when is ran it takes over the OS, until exited then waits for some code... in loop :)
|
All times are GMT +2. The time now is 12:28. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.