randall at randallreetz.com
Wed Jan 21 11:46:37 CST 2009
Richard, how big is the folder you are monitoring? How nested? I have written similar code of course. But it doesnt scale. And by definition it isnt real time.
From: "Richard Gaskin" <ambassador at fourthworld.com>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: 1/21/2009 9:10 AM
Subject: Re: externals
> why not instead let user choose folders or files that should be
> monitored and then monitor these by comparing files (get files etc...),
> folders (get folders) regularly. Use recursion to get into sub folders,
> etc. Revolution is fast enough to do this efficiently.
That's an excellent idea. I was curious about how responsive it would
be, so I took a couple minutes to throw together an example of this and
it seems reasonably efficient.
I've posted the example to RevNet - in Rev, choose
Development->Plugins->GoRevNet, and in RevNet look for "4W Folder
Watcher" in the Stacks section.
This modest example lets you pick a folder and it checks for changes to
files (name, size, additions, deletions). It also provides a slider to
govern the interval between checks so you can experiment to find the
best balance between system overhead and responsiveness.
One useful aspect of it is that the folder watching hander accepts the
name of a callback handler as a param, so you can handle the change
event however you like without having to modify the folder watcher
This is a very simple example, with lots of room for improvements like
also checking folder changes within the target folder, and possibly
sending additional info about exactly what changed to the callback
handler if needed.
But as a quick-n-dirty experiment, at least it shows that Rev can be
used to monitor changes to folder contents with relative ease and
acceptable efficiency for many uses, and on all supported platforms.
Revolution training and consulting: http://www.fourthworld.com
Webzine for Rev developers: http://www.revjournal.com
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode