Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

New File Detection

Posted on 2006-06-19
9
Medium Priority
?
257 Views
Last Modified: 2008-02-26
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.
0
Comment
Question by:pcarrollnf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 16934430
It is a system function in MSWindows, only accessible by JNI.
In LINUX and UNIX you keep polling.

;JOOP!
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16934722
Yes, you will need to some kind of directory monitor otherwise:

http://www.javalobby.org/java/forums/t12334.html
0
 

Author Comment

by:pcarrollnf
ID: 16934760
I am just wondering if that JNIWrapper is commercial software?  Thanks.
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 30

Expert Comment

by:Mayank S
ID: 16934772
It is free, I guess, but quite commonly used. However, why do you want to use it?
0
 

Author Comment

by:pcarrollnf
ID: 16934802
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 16934842
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
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 16935039
The advantages of polling may outweight the disadvantages:

http://geosoft.no/software/filemonitor/FileMonitor.java.html
0
 
LVL 10

Expert Comment

by:rajesh_bala
ID: 16989943
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 17139562
:-)
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question