# Monitoring folder for changes

**URL:** <https://rubytalk.org/t/monitoring-folder-for-changes/52542>\
**Category:** ruby-talk\
**Created:** [27 March 2009 23:39 UTC](https://rubytalk.org/t/monitoring-folder-for-changes/52542 "2009-03-27T23:39:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felipe\_Coury](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@Felipe\_Coury](https://rubytalk.org/u/Felipe_Coury)\
**Post date:** [27 March 2009 23:39 UTC](https://rubytalk.org/t/monitoring-folder-for-changes/52542/1 "2009-03-27T23:39:48Z")

</div>

Is there any gem or code example that would help me to watch a given  
folder for changes and trigger a callback upon change detection?

Thanks!

-- Felipe

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![a11](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/a11/32/8169_2.png) [@a11](https://rubytalk.org/u/a11)\
**Post date:** [27 March 2009 23:46 UTC](https://rubytalk.org/t/monitoring-folder-for-changes/52542/2 "2009-03-27T23:46:11Z")

</div>

sudo gem install directory\_watcher

a @ [http://codeforpeople.com/](http://codeforpeople.com/)

> **···**
>
> On Mar 27, 2009, at 5:39 PM, Felipe Coury wrote:
> 
> > Is there any gem or code example that would help me to watch a given  
> > folder for changes and trigger a callback upon change detection?
> > 
> > Thanks!
> > 
> > -- Felipe  
> > -- Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
> 
> --  
> we can deny everything, except that we have the possibility of being better. simply reflect on that.  
> h.h. the 14th dalai lama

---

<div class="post-metadata">

**Author:** ![Felipe\_Coury](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@Felipe\_Coury](https://rubytalk.org/u/Felipe_Coury)\
**Post date:** [27 March 2009 23:52 UTC](https://rubytalk.org/t/monitoring-folder-for-changes/52542/3 "2009-03-27T23:52:51Z")

</div>

Ara Howard wrote:

> sudo gem install directory\_watcher  
> a @ [http://codeforpeople.com/](http://codeforpeople.com/)

Now that was fast! Thanks Ara!

Best regards,

-- Felipe

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Brian\_Adkins](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Brian\_Adkins](https://rubytalk.org/u/Brian_Adkins)\
**Post date:** [28 March 2009 13:25 UTC](https://rubytalk.org/t/monitoring-folder-for-changes/52542/4 "2009-03-28T13:25:06Z")

</div>

Felipe Coury \<felipe.coury@gmail.com\> writes:

> Ara Howard wrote:
> 
> > sudo gem install directory\_watcher  
> > a @ [http://codeforpeople.com/](http://codeforpeople.com/)
> 
> Now that was fast! Thanks Ara!

If speed is more important than portability, you may want to consider utilizing operating specific features. I believe Linux, OSX & Windows all provide notifications of changes to the file system so you wouldn't have to periodically poll.

> **···**
>
> --  
> Brian Adkins  
> [http://lojic.com/](http://lojic.com/)
