Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an application that needs to process large files after they are uploaded to the system. In Linux, is it possible to detect folder changes and have a script run automatically, or should I just run a cron job every minute to look for new files?

share|improve this question
You may have more luck with this question on StackOverflow. – John Gardeniers Aug 3 '09 at 0:13
up vote 6 down vote accepted

Checkout inotify. If your running a recent kernel it will be included. There are numerous APIs for numerous languages out there for it.

share|improve this answer
I just want to run a Perl script when a file gets added to folder. Is this difficult to implement with inotify? – user15336 Aug 2 '09 at 22:58
IT shouldn't be (I've never done it in Perl though), there are some modules in CPAN ( that will help take the pain out of the process. – David Aug 3 '09 at 23:44

Ionotify, as David says, is what you're looking for. Iowatch is a little Perl script that uses Ionotify, via Perl, to report changes to a filesystem. Assuming you've got a degree of Perl scripting experience you should be able to hack this into something that does what you want.

share|improve this answer

You need a File Alteration Monitor. Take a look on

share|improve this answer

If you need a simple frontend to FAMs, fileschanged can be useful, at least for prototyping.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.