Thread: Poll directory to detect a change?

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    40

    Poll directory to detect a change?

    I want to write a program to do something whenever a certain type of file appears in a certain directory. What's the best way to do this?

    Do you have to poll the directory to detect the change? Or is there some way of hooking into the OS so you get an 'event' when appropriate?

    We're talking linux here.

  2. #2
    Registered User
    Join Date
    Jan 2010
    Location
    Ca, US
    Posts
    29
    Lookup inotify it's kind of new to the linux kernel, added in 2.6.ish

    Dylan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. accessing all files in a folder.
    By pastitprogram in forum C++ Programming
    Replies: 15
    Last Post: 04-30-2008, 10:56 AM
  2. Can't change directories via system("cd");
    By Frosty in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 10:45 AM
  3. Today on Cprogramming....When Polls go bad?
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 01-25-2002, 01:41 PM
  4. The Site Directory
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 01-22-2002, 08:19 PM
  5. Replies: 2
    Last Post: 09-04-2001, 02:12 PM