How to monitor changes in a directory

Discussion in 'Perl Misc' started by Lorenzo Thurman, Nov 9, 2006.

  1. I want to monitor a directory for changes, but I don't want to poll
    periodically to see if anything has changed. Is there a way to get
    notifications in Perl about changes to a particular directory.
    TIA
    Lorenzo Thurman, Nov 9, 2006
    #1
    1. Advertising

  2. Lorenzo Thurman

    Guest

    Lorenzo Thurman wrote:
    > I want to monitor a directory for changes, but I don't want to poll
    > periodically to see if anything has changed. Is there a way to get
    > notifications in Perl about changes to a particular directory.
    > TIA


    This isn't really a problem that Perl alone can solve. Essentially you
    must poll and there are a few ways to do that. crontab
    http://en.wikipedia.org/wiki/Crontab can be used on Unixish systems to
    schedule a script (Perl or otherwise) to run periodically and scan a
    directory, for example.

    On some systems, like Mac OS X, you can use "folder actions"
    http://www.apple.com/applescript/folderactions/ to cause an AppleScript
    to run whenever a folder is modified. There may be something similar on
    Windows, I'm not sure.

    In any case you will need to use something in addition to perl, and
    that will be dependent on your OS.

    -------------------------------------
    Michael
    http://www.perlcircus.org/
    , Nov 9, 2006
    #2
    1. Advertising

  3. Lorenzo Thurman

    Ben Morrow Guest

    Quoth Lorenzo Thurman <>:
    > I want to monitor a directory for changes, but I don't want to poll
    > periodically to see if anything has changed. Is there a way to get
    > notifications in Perl about changes to a particular directory.


    This depends on your OS. Under Win32 there is the Win32::ChangeNotify
    module; I've never used it so I don't know how well it works. Under some
    versions of IRIX and Linux you can run famd and use SGI::FAM. Under some
    versions of Linux you can use the Linux::Inotify or Linux::Inotify2
    modules.

    Ben

    --
    "Faith has you at a disadvantage, Buffy."
    "'Cause I'm not crazy, or 'cause I don't kill people?"
    "Both, actually."
    []
    Ben Morrow, Nov 9, 2006
    #3
  4. Lorenzo Thurman

    Guest

    Lorenzo Thurman <> wrote:
    > I want to monitor a directory for changes, but I don't want to poll
    > periodically to see if anything has changed. Is there a way to get
    > notifications in Perl about changes to a particular directory.


    That is OS dependent. On linux, there is "fam". There seem to be some
    Perl interfaces to it in CPAN, but I've never used them.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Nov 9, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shawn Jensen

    Failed to monitor File Changes--HELP!!!

    Shawn Jensen, Jul 15, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    468
    Shawn Jensen
    Jul 15, 2003
  2. =?Utf-8?B?cGFhcGEyMQ==?=

    Failed to monitor changes error please help

    =?Utf-8?B?cGFhcGEyMQ==?=, Jan 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    333
    =?Utf-8?B?cGFhcGEyMQ==?=
    Jan 16, 2006
  3. support

    monitor websites for changes

    support, Jul 29, 2003, in forum: HTML
    Replies:
    0
    Views:
    328
    support
    Jul 29, 2003
  4. ScottZ
    Replies:
    2
    Views:
    343
    Jorgen Grahn
    Nov 2, 2008
  5. Junkone

    monitor changes to website

    Junkone, Feb 13, 2008, in forum: Ruby
    Replies:
    1
    Views:
    100
    ThoML
    Feb 13, 2008
Loading...

Share This Page