Folder Update Triggering

Hi All,

Big time Ruby novice here; I apologize in advance.

I’m looking to create a Ruby app that generates a folder/sub-folder
index file every time the main folder is updated (i.e., new sub-folders
are added, renamed, etc.). Everything seems pretty simple and straight
forward. The only part I’m having a hard time “pre-engineering” is the
folder update/trigger file update part. That is, how can I get my
app–while running in the background–to update my index file every time
there is a folder update? Can anyone point me to a class/method that
might help?

Thanks,
-Brandon

how about ruby-inotify ? http://raa.ruby-lang.org/project/ruby-inotify/

On Wed, Oct 20, 2010 at 3:26 AM, Steel S. [email protected]
wrote:

how about ruby-inotify ? http://raa.ruby-lang.org/project/ruby-inotify/

Alternative would be to lazily update the index whenever it is
accessed. Depends which approach is more promising. Rule of thumb:
if there are rare updates but frequent index accesses push approach
(inotify) will be better. If there are frequent updates but only rare
index accesses pull (my alternative) will be better. YMMV though.

Kind regards

robert

Robert K. wrote in post #955732:

On Wed, Oct 20, 2010 at 3:26 AM, Steel S. [email protected]
wrote:

how about ruby-inotify ? http://raa.ruby-lang.org/project/ruby-inotify/

Alternative would be to lazily update the index whenever it is
accessed. Depends which approach is more promising. Rule of thumb:
if there are rare updates but frequent index accesses push approach
(inotify) will be better. If there are frequent updates but only rare
index accesses pull (my alternative) will be better. YMMV though.

Kind regards

robert

Robert,

Thanks for the advice. I never even thought about that. Unfortunately,
the index-accesses to folder-updates ratio will be about 10:1. Not to
mention, the index will be pulled in “bursts” so it would slow things
down a bit if it had to be updated every time it was read. Not a bad
idea though.

Brandon,

Sounds like win32-changenotify might be what you’re after. Or
win32-changejournal.

http://win32utils.rubyforge.org/

From that website:

The win32-changenotify library lets you monitor files or directories
for certain events, such as when a file is created, modified, deleted,
etc.
Although deprecated in favor of win32-changejournal on NTFS
filesystems, this library is still maintained because not everyone
uses NTFS. It also has the advantage of being pure Ruby, which may or
may not be a selling point for you.

Installation: gem install win32-changenotify.

Charles

Steel S. wrote in post #955626:

how about ruby-inotify ? http://raa.ruby-lang.org/project/ruby-inotify/

Thanks, Steel. A big caveat I forgot to mention is that the folder(s)
are located on a Windows based system. From my limited research, it
looks like I’ll want to dig into the win32ole class–maybe…