Folder Update Triggering

B

Brandon P.

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
 
B

Brandon P.

Robert Klemme wrote in post #955732:
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.
 
C

Charles Roper

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top