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. Advertisements

  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. Advertisements

  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. Advertisements

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. TJS
    Replies:
    1
    Views:
    661
    Eliyahu Goldin
    Jun 23, 2004
  2. Bob Garbados
    Replies:
    5
    Views:
    584
    Bob Garbados
    Dec 22, 2004
  3. =?Utf-8?B?QmFzIEhlbmRyaWtz?=

    Directory and files names in temporary asp.net directory

    =?Utf-8?B?QmFzIEhlbmRyaWtz?=, Jan 28, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    1,605
    Juan T. Llibre
    Jan 31, 2005
  4. news.microsoft.com
    Replies:
    1
    Views:
    996
    fd123456
    Feb 27, 2005
  5. kai
    Replies:
    6
    Views:
    747
    Steven Cheng[MSFT]
    Nov 28, 2005
  6. Replies:
    1
    Views:
    767
    Evertjan.
    Sep 30, 2005
  7. Replies:
    1
    Views:
    308
    Evertjan.
    Sep 30, 2005
  8. iMath
    Replies:
    8
    Views:
    548
    emile
    Nov 13, 2012
Loading...