Programming an Event listener for files in a directory on Linux
Posted
by Epitaph
on Stack Overflow
See other posts from Stack Overflow
or by Epitaph
Published on 2010-05-08T19:59:09Z
Indexed on
2010/05/08
20:08 UTC
Read the original article
Hit count: 395
On Ubuntu linux, when you watch a flash video, it gets saved temporarily in the /tmp as flv files while the video buffers. I use vlc to directly play these files.
Currently, I have scripted a shortcut that directly scans and opens the latest file in /tmp with vlc, when clicked.
But, I want to program a Java application that will continually monitor this /tmp directory for any new flv files, and open it in vlc automatically. I know I can use Runtime.exec() to open the VLC application with the flv files. But, I DO NOT want to run a while(true) loop (with sleep) to scan for files.
How can I make use of Event Handling (Java or any other language) on Linux to complete this task?
© Stack Overflow or respective owner