New File Detection

I am trying to determine when a file has been added to a particular directory on the file system.  I am trying to stay away from polling the directory.  Is there some way of detecting the existence of a new file immediately?  I am using jdk 1.4.2.  Thanks.
pcarrollnfAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
CEHJConnect With a Mentor Commented:
The advantages of polling may outweight the disadvantages:

http://geosoft.no/software/filemonitor/FileMonitor.java.html
0
 
sciuriwareCommented:
It is a system function in MSWindows, only accessible by JNI.
In LINUX and UNIX you keep polling.

;JOOP!
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Yes, you will need to some kind of directory monitor otherwise:

http://www.javalobby.org/java/forums/t12334.html
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
pcarrollnfAuthor Commented:
I am just wondering if that JNIWrapper is commercial software?  Thanks.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
It is free, I guess, but quite commonly used. However, why do you want to use it?
0
 
pcarrollnfAuthor Commented:
I want to use it in an application we are working on at the software company I work for.  I will have to read the license agreement to determine its policy on redistribution because if we use it, we will package it with our software which is commercial.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
That's a totally different question from this one ;-)

Anyway, I think only the evaluation is free and otherwise you need to pay to buy it:

http://www.jniwrapper.com/pages/home
0
 
rajesh_balaCommented:
Hi,

You can have a look at the following link which is pure JAVA based implementation

http://www.rgagnon.com/javadetails/java-0490.html

I am not sure if this might be something similiar to what CEHJ has posted. But the above link has fewer lines of code. So might be pretty easy to modify it to suit your needs.

~Rajesh.B
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.