I want to write a listener (ruby module) to identify a file creation inside a folder. My scenario is as follows
Where can I start on creating this Ruby module?
I'm using 'Ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]'.
There are a few small libraries, which you could utilize, learn from or build upon, e.g.
Agile development tool that monitors a directory tree, and triggers a user defined action whenever an observed file is modified. Its most typical use is continuous testing, and as such it is a more flexible alternative to autotest.
The directory watcher operates by scanning a directory at some interval and generating a list of files based on a user supplied glob pattern. As the file list changes from one interval to the next, events are generated and dispatched to registered observers. Three types of events are supported — added, modified, and removed.
Guard is a command line tool to easily handle events on files modifications (FSEvent / Inotify / Polling support).
This is a simple wrapper over the inotify Linux kernel subsystem for monitoring changes to files and directories. It uses the FFI gem to avoid having to compile a C extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With