Total members 11895 |It is currently Sun Dec 22, 2024 9:46 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Currently i'm developing an appilcation(notifier) for monitoring amount of files
in hot folder (transaction folder) which is another engine move several file
from that folder. If the amount of files get bigger and bigger in the hot folder
then that is a signal indication that an engine was hang or down, so my
application will notify to anybody via Email.

Question is:

What is suitable java methode or how to monitoring the age of file in the hot
folder,whereas the amount of file in hot folder is fluctuatif ?




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

To find the number of files in a directory:
1) Get a File object for the directory:
File dir = new File ("dir/path");
2) Get the number of files in that direcory:
String [] names = dir.list ();
3) Get the size of the name list. This is the number of files in the
directory.
int numEntries = names.length;

To do this periodically, put this in the run () method of a TimerTask,
and set up the TimerTask to execute periodically through a Timer object.
To get the Javadoc for these classes, see
http://java.sun.com/j2se/1.5.0/docs/api/ .

_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Java File age monitoring
 Copy file to file in java code- implementation     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 Creating a JAR file in Java     -  
 get the Contents of a ZIP File in java     -  
 Write and Read to File In Java Example     -  
 Marshal Java object to XML file     -  
 passing string value from java to .exe file     -  
 Create set up file of my java application     -  
 How to create a file in java script using FireFox     -  
 insert information in html file with java     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com