Listening for files in a directory

Discussion in 'Perl' started by Poul Møller Hansen, Jan 13, 2005.

  1. I'm trying to make a solution that can listen for files in a given
    directory,
    and process the files as soon they have been written.

    So far I'm executing the script once per minute, but I would like a realtime
    scan for files.
    Does any of you know how to start on this ?

    TIA, Poul
     
    Poul Møller Hansen, Jan 13, 2005
    #1
    1. Advertising

  2. Poul Møller Hansen

    Jim Gibson Guest

    In article <41e62bd1$0$33639$>, Poul
    Møller Hansen <> wrote:

    > I'm trying to make a solution that can listen for files in a given
    > directory,
    > and process the files as soon they have been written.
    >
    > So far I'm executing the script once per minute, but I would like a realtime
    > scan for files.
    > Does any of you know how to start on this ?


    Notification when a file is created sounds like an operating system
    function, and I have never heard of any operating system offer this
    function as a general feature. It is usually up to the processes
    involved to notify each other when some event has occurred.

    As a work around, I would just keep a script running all of the time
    increase the frequency of checking. If you code the process
    efficiently, you should be able to check every second. Of course, your
    ultimate speed depends upon your hardware and your operating system. If
    you want faster response, you are going to have to modify the process
    creating the files so it can notify or spawn the process that wants to
    know about the new files.

    FYI: this newsgroup is defunct; try comp.lang.perl.misc in the future.

    --
    Jim Gibson


    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= East/West-Coast Server Farms - Total Privacy via Encryption =---
     
    Jim Gibson, Jan 13, 2005
    #2
    1. Advertising

  3. Poul Møller Hansen

    Joe Smith Guest

    Jim Gibson wrote:
    > In article <41e62bd1$0$33639$>, Poul
    > Møller Hansen <> wrote:
    >
    >>I'm trying to make a solution that can listen for files in a given
    >>directory, and process the files as soon they have been written.
    >>
    >>So far I'm executing the script once per minute, but I would like a realtime
    >>scan for files. Does any of you know how to start on this ?

    >
    > Notification when a file is created sounds like an operating system
    > function, and I have never heard of any operating system offer this
    > function as a general feature.


    Linux has it. I don't know if it is older versions, but Red Hat 9
    includes SGI's File Alteration Monitor which meets the requirements.

    http://search.cpan.org/~jglick/SGI-FAM-1.002/lib/SGI/FAM.pm

    -Joe
     
    Joe Smith, Jan 16, 2005
    #3
    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. Bob Garbados
    Replies:
    5
    Views:
    466
    Bob Garbados
    Dec 22, 2004
  2. kai
    Replies:
    6
    Views:
    593
    Steven Cheng[MSFT]
    Nov 28, 2005
  3. Andy Fish

    Re: listening to the clipboard

    Andy Fish, Aug 1, 2003, in forum: Java
    Replies:
    4
    Views:
    423
    Chris Smith
    Aug 5, 2003
  4. Marco Lorenzini
    Replies:
    0
    Views:
    389
    Marco Lorenzini
    May 13, 2004
  5. Roy Epperson

    Listening to htttp requests

    Roy Epperson, Mar 3, 2005, in forum: Java
    Replies:
    2
    Views:
    350
    Thomas Weidenfeller
    Mar 3, 2005
Loading...

Share This Page