LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-04-2010, 04:38 AM   #1
rs232
Member
 
Registered: Oct 2005
Posts: 51

Rep: Reputation: 0
"on folder change"


Hello, is there any way to execute a command every time a "folder changes status"?
Under windows there's an API which pro-actively tells you when something has changed within a directory, so I was trying to achieve something similar under Linux.
I can't think anything else other than check the list of files and parameters (e.g. date/size/owner) every few seconds, but that's not ideal of course... So what I'm asking here is: is there is a way to set linux to tell me rather than me go and check?

I hope my question makes sense :-p

Cheers
 
Old 06-04-2010, 05:17 AM   #2
posixculprit
Member
 
Registered: May 2010
Posts: 136

Rep: Reputation: 42
Have a look at inotify and FAM.
 
Old 06-04-2010, 05:28 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
From your own code use inotify - from a script use inotify-tools; you can wait on file(s) or directory(s).
I believe tail has been recently rewritten to use inotify rather than polling.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] There is no "menu.lst" in my Ubuntu "/boot/grub/" folder. msbstar Linux - Newbie 18 09-15-2012 01:26 PM
After installing XAMPP for linux i have seen the folder "htdocs" belongs to "nobody". tirengarfio Linux - General 6 03-17-2010 01:41 PM
cannot change permissions on "modem" folder techemically Linux - Newbie 5 08-23-2008 10:42 AM
Can't change folder permission - owner is "33" kfogalin Linux - Newbie 2 01-30-2008 03:07 PM
"rm -rf /tmp", now Evolution shows "(no folder displayed" Ed-MtnBiker Linux - Software 7 04-10-2006 04:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration