#1
  1. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    538

    Question Directory polling?


    I'd like to have a program (daemon, service)poll a folder and do some action on it's content.
    How can I do this in java, php, python ... anything?
    Thanks in advance for your help!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jul 2001
    Location
    Oslo
    Posts
    1,516
    Rep Power
    14
    The easiest way is probably to write script which does this, then run it on regular intervals using cron (if on unix). I don't know what you have to use on windows, but I'm sure a similiar tool is available.

    Comments on this post

    • JimmyGosling agrees
    • BaronVonDoppleG agrees
    --
    Regards
    André Nęss

    Puritanism: The haunting fear that someone, somewhere may be having fun
  4. #3
  5. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    538
    Well, there is plenty of such programs, but they are all commercial.
    I need a service/daemon because it has to poll the directory "continuously", and I don't think that a cron that runs every 5 sec. would be right.
    Do you know of any opensource project of this kind? Or a tutorial about building a service/daemon?
    Regards.
  6. #4
  7. No Profile Picture
    Your Friend
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    9
    Rep Power
    0
    Originally posted by pabloj
    I need a service/daemon because it has to poll the directory "continuously"
    So basically you want to "hook up" the OS functions manipulating with directory files (creating/modifying),etc. ?

    Comments on this post

    • JimmyGosling agrees
    • BaronVonDoppleG agrees
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jul 2001
    Location
    Oslo
    Posts
    1,516
    Rep Power
    14
    Well, I guess that's just a program which does something every 5 seconds and sleeps for the rest of the time... You could even use a simple PHP script for that, although it's probably better to write it in C to avoid wasting resources:
    PHP Code:
    while(true) {
      
    //Poll directories
      
    sleep(5);

    --
    Regards
    André Nęss

    Puritanism: The haunting fear that someone, somewhere may be having fun
  10. #6
  11. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    538

IMN logo majestic logo threadwatch logo seochat tools logo