Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Detecting changed files

Thread view: 
Mark  Schnitzius - 22 Mar 2006 03:38 GMT
I'm writing a Java application that deals with bunches of files and
does various CVS things with them.

I'm wondering how to detect which files (from a list that I keep) have
been changed by outside applications.

One way would be to poll every n seconds.  Is this how applications
typically do it?  Or is there some way to listen for some sort of
system internal call?

AdTHANKSvance,
Mark
Chris Smith - 22 Mar 2006 06:48 GMT
> One way would be to poll every n seconds.  Is this how applications
> typically do it?  Or is there some way to listen for some sort of
> system internal call?

Polling is the best you can do in pure Java.  It's fairly common for
operating systems to provide a better way, though, if you have a
specific target OS and are willing to suffer the deployment and build
process hassles associated with writing native code.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Roedy Green - 22 Mar 2006 06:52 GMT
>I'm writing a Java application that deals with bunches of files and
>does various CVS things with them.
[quoted text clipped - 5 lines]
>typically do it?  Or is there some way to listen for some sort of
>system internal call?

see http://mindprod.com/projects/filefinder.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 22 Mar 2006 17:37 GMT
> I'm writing a Java application that deals with bunches of files and
> does various CVS things with them.
[quoted text clipped - 5 lines]
> typically do it?  Or is there some way to listen for some sort of
> system internal call?

   What some programs do as an *APPROXIMATION* to solving your problem is
to just check for file changes whenever the editor for that file loses, and
regains focus.

   Let's pretend your app is a text editor. If I'm typing away in the text
file, but the file gets changed by someone over a network, the app wouldn't
realize it at all and just allow me to keep typing. However, if I alt-tab
out and works with another app, then alt-tab back in, the program would
check upon this regaining of focus, and notify me that the file has been
changed.

   - Oliver
Mark  Schnitzius - 23 Mar 2006 05:50 GMT
> > I'm wondering how to detect which files (from a list that I keep) have
> > been changed by outside applications.
[quoted text clipped - 13 lines]
> check upon this regaining of focus, and notify me that the file has been
> changed.

Good call.  That beats setting up a separate process, in several ways.
I'll probably tackle it that way.

Thanks, Oliver, and everyone else...

--Mark


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.