New File Detection

Posted on 2006-06-19
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.
Question by:pcarrollnf
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
LVL 24

Expert Comment

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

LVL 30

Expert Comment

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

Author Comment

ID: 16934760
I am just wondering if that JNIWrapper is commercial software?  Thanks.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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?

Author Comment

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.
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:
LVL 86

Accepted Solution

CEHJ earned 125 total points
ID: 16935039
The advantages of polling may outweight the disadvantages:
LVL 10

Expert Comment

ID: 16989943

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

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.

LVL 86

Expert Comment

ID: 17139562

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
spring jars download 1 67
dao vs facade design patterns 2 69
Java List 4 76
listing all the respondents to a twitter feed - Java 5 44
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

734 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