Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Find the files that has been modified before run the program

Have Programming Question? Ask it here!
 
 
 


Ian
Find the files that has been modified before run the program
1 Answer(s)      a year and 3 months ago
Posted in : Java Beginners


Hi. I have a code that can find the latest modified file in the directory. ` //store the file to the list List<File> list = new ArrayList<File>(Arrays.asList(store)); //combine all the file at main folder and sub folder Object[] combine = list.toArray(); //sort the file according to the date Arrays.sort(combine, new Comparator<Object>(){ public int compare(Object o1, Object o2){ return compare((File)o1, (File)o2); } public int compare( File f1, File f2){ long StartTime = f2.lastModified() - f1.lastModified(); if( StartTime > 0 ){ return 1; }else if( StartTime < 0 ){ return -1; }else { return 0; } } }); //get the file name that has latest modified date files = ((File) combine[0]).getName(); //get the file date that has latest modified date lastModifiedDate = new java.util.Date(((File)combine[0]).lastModified()).toString(); System.out.println("The latest modified file is : "+files); System.out.println("The time for the latest modified's file is :"); System.out.println(lastModifiedDate); } }`

When i modified a file in the directory and run the program, it can list out the file that i has been modified. But when i modified more then 1 files in the directory and run the program, it can only show the file that has the latest modification time. My question is: How can i list out all the files that has been modified before i run the program?


Advertisement
View Answers

May 30, 2013 at 9:07 AM


Sorry. Please help me remove this post. This post got some typo error. I had already re-post the same question to the page.



Related Tutorials/Questions & Answers:
Find the files that has been modified before run the program
Find the files that has been modified before run the program  Hi. I.... My question is: How can i list out all the files that has been modified before... that i has been modified. But when i modified more then 1 files in the directory
Find the files that has been modified before run the program
Find the files that has been modified before run the program  Hi. I... is: How can i list out all the files that has been modified before i run... in the directory and run the program, it can list out the file that i has been
Advertisements
Find the files that has been modified before run the program
Find the files that has been modified before run the program  Hi. I... is: How can i list out all the files that has been modified before i run... in the directory and run the program, it can list out the file that i has been
Find the date of the file before the file has been modified
Find the date of the file before the file has been modified  Hi, may i know is it possible to find the date of the file before the file has been modified?   hi friend, you can get the date of last modified file using
how to find which user has modified the file
how to find which user has modified the file  how to find which user has modified the file
Resources have been modified iPhone
Resources have been modified iPhone  Hi, My client is getting Resources have been modified error while installing AdHoc distribution on his iPhone. How to solve Resources have been modified iPhone error? Thanks   Hi
how to run java program that has several classes under package from usb drive?
how to run java program that has several classes under package from usb drive... package. I have to use following line on command line to compile and run my program... command line and it works. I copied all java files and class files to flash drive
The app was not installed on iphone because its resources have been modified
resources have been modified" What is the solution? Thanks   Hi, You have...The app was not installed on iphone because its resources have been modified  Hi, I am getting following error while my client is installing my
Call-time pass-by-reference has been removed in
Call-time pass-by-reference has been removed in  HI, What is the solution for the error: Call-time pass-by-reference has been removed in Thanks
Tomcat Error: coyote connector has not been started
Tomcat Error: coyote connector has not been started  Hi, I am not able to start the tomcat server. If I try to start it then I am getting the below error. "coyote connector has not been started" Could some body please help me
JBoss Tools 3 Alpha has been released
The first Alpha release of JBoss Tools 3 has been made recently with intials..., Portal etc. All plugins in the new release have been now shifted to Eclipse 3.4/WebTools 3.0 so that it will run only on Ganymede
the JDBC Driver has been forcibly unregistered
the JDBC Driver has been forcibly unregistered  Hi my application... application was st opped. To prevent a memory leak, the JDBC Driver has been... the web application was stopped. To prevent a memory leak, the JDBC Driver has been
getOutputStream() has already been called for this response
getOutputStream() has already been called for this response  hi... exception: java.lang.IllegalStateException: getOutputStream() has already been...="FindCustomer"> <input type="submit" class="loggedinlabel" title="Find
How to find run time in SQL.
How to find run time in SQL.  I have 10 backend jobs in sql which... 22/10/2010 17:30:00 I want to find the run time of both the jobs. (i.e when i run the query it should show me how long job has been running) Could you please
Protecting Your iPad Has Never Been Easier
Protecting Your iPad Has Never Been Easier Since its release early in 2010, the iPad has been flying off the shelves in stores all over the world... of accessories for the iPad, each of which has been designed to ensure you get the most out
Exception: java.lang.IllegalStateException: getWriter() has already been called for this response - JSP-Servlet
Exception: java.lang.IllegalStateException: getWriter() has already been called for this response    response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); Statement st1
how to run rmi program
how to run rmi program  how to run rmi program
How Jdbc program can be run??
,but when i run it ,it gives following error-> C:\Program Files\Java...How Jdbc program can be run??  import java.sql.*; import java.util....:"+sq.getMessage()); } } } I have created Dsn Successfully ,table also has been
how to run this program?
how to run this program?  how to run java swing program   Java Swing program runs same as a simple java program. There is no difference... with javac and run with java command, same as a simple java program. Learn Swing
How to find if you have been hit by Panda 4.0
How to find if you have been hit by Panda 4.0  Hi, This week Google Panda 4.0 is released. Now the question is how to find if your website have been hit by Panda 4.0? Thanks   Hi, There are many ways you can find
How to run a Java program in CMD
discussed how to write and run Java program in CMD. Tips to run Java program... command at your command prompt. set path=%path%;C:\Program Files\Java\jdk1.5.0_09... it should compile the file.  Now time to execute the program. Run
How to run java swing application from jar files .
How to run java swing application from jar files .  Hello Sir... setup file .As per my knowledge i have to run .jar file from dist folder of netbeans but when i am trying to run from there i am getting error "Could not find
compile and run java program
compile and run java program  Hello, everyone!!! I just want to ask if you anyone here knows how to compile java file in linux specifically UBUNTU... do I compile and run this file using the terminal of ubuntu... By the way, I am
how to run java program
how to run java program  i have jar file. in jar i have so many classes.in one of file i want modify .after modifying file i want replce in jar. please help me to how to generate class and how to replace
couldnt run this program
couldnt run this program  package calculator; import java.util.Scanner; public class calculator{ public static void main(String args[]){ Scanner vin = new Scanner(System.in); Double firstnum,secondnum,sum,sub,mul
How to compile and run Java program
How to compile and run Java program  How to compile and Java program..., For compiling and running the Java program from command prompt you should must have JDK... tutorial Compiling and Running Java program from command line. If Java
how to compile and run servlet program
how to compile and run servlet program   hello sir/mam i hve installed tomcat5.5 version and also have jdk1.6.0_14 installed but not able to run it or compile i m doing it first tyme pls help me in sorting out this problem. i hve
We can run Java on most platforms provided a platform must has a Java interpreter
; We can run Java on most platforms provided a platform must has a Java... of the activities of the Java run-time system. It loads Java class files and interprets... program to run Java applets. It is included in the SDK. It helps you to test an applet
how to run audio files in net beans using j2me
how to run audio files in net beans using j2me  i am running the audioMidlet in net beans. Now where should i place the .wav files inorder to play them
Unable to run jsp files on internet explorer - JSP-Servlet
Unable to run jsp files on internet explorer  Hi, I am Akhilesh... a small jsp program stored in the Web-Apps folder of Apache Tomcat. But i checked alwz open jsp files with internet explorer from tht point onwards whnever
why java program not run with msword editor
why java program not run with msword editor  if java program write in MICROSOFT WORD then why they are not run with jdk
how to run jdbc program in linux-ubuntu?
how to run jdbc program in linux-ubuntu?   how to run jdbc program in linux-ubuntu
find jar file name from multiple set of jar files
find jar file name from multiple set of jar files   I would like to find jar file name from multiple set of jar files where the given class name√Ę‚?¨¬?com.rational.ft.util.debug√Ę‚?¨¬
How to run program in new opened cmd
How to run program in new opened cmd  Hello i have made a program in java to open command prompt, then how to run my left of the program in the new opened command prompt
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
how to run a java program using run.exec()?
how to run a java program using run.exec()?  Hi..i want to compile and run a java file using run.exec().i.e., without compiling and running from command prompt i want to do them in the program itself.I am able to compile
how to run jdbc in jsp program - JSP-Servlet
how to run jdbc in jsp program  i want to use sql server 2005 in jsp program to store data.i know how to run simple program but this program i tried my best i am not able to do so.please give me the answer of this as soon
how to run jdbc program in linux-ubuntu?
how to run jdbc program in linux-ubuntu?  how to run jdbc program in linux-ubuntu?   hi firstly download the jdk on your system using... to compile java program javac prog.java java prog
How to Run First Java Bean Program ?
How to Run First Java Bean Program ?  Hi My Dear Friend I can run... But Now I need that How to run Java Bean Now I have BDK1.1 But still don't know that how run this... I have this bdk dir... \bdk1_1\beans\beanbox
run command prompt from jsp program
run command prompt from jsp program  Hi.... Is it possible to run a command prompt from jsp? If possible please help me with some code... Thanks & Regards vanchinathan.R
Program to find no of metrics in a file ----- Java code
Program to find no of metrics in a file ----- Java code  Hi Friends, I got a task to calculate the metrics of a program, like to find the no of SELECT and INSERT statement is a program. With that I have to even calculate
Last modified time of a webpage
Last modified time of a webpage  how can we get the last modified time of a webpage using java
Last modified date of a folder
Last modified date of a folder  How to get the last modified date of a folder specified by a link in html
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?  run: java.lang.NoClassDefFoundError: filecopy...) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main
How to Develop, Compile & Run a rmi Program in NetBeans 6.9.1 ide?
How to Develop, Compile & Run a rmi Program in NetBeans 6.9.1 ide?  how to develop, compile & run a rmi program in netbeans 6.9.1 ide? will you please give me a step by step (practical) explaination? Thanks in advance
New to JSP..need help to make & run a JSP program.
New to JSP..need help to make & run a JSP program.  Hi, I have installed Tomcat 5.5 on my system. Plz help me to make a simple JSP program. And also how to run it.   Hi Friend, Have you set the classpath? Anyways
java program to read multiple files from a directory and display them on a jframe
java program to read multiple files from a directory and display them on a jframe  hi guys i want to write a java program that will read all files in a directory and display them one by on on a jframe on jpanel with specific key
Modified shap - Java Beginners
Modified shap  Respected Sir, Now i need of diamond shap with outline of diamond shape.Using single" " and "*" with looping structure.Please help me!  Hi Friend import java.io.*;import java.io.BufferedReader;public
files
files  write a java program to calculate the time taken to read a given number of files. file names should be given at command line.   Hello Friend, Try the following code: import java.io.*; import java.util.*; class
.jar file keeps giving me " could not find the main class". Program will exit.
.jar file keeps giving me " could not find the main class". Program will exit.  Hi I have been having problems with this on both netbeans and eclipse... click on it, it gives me the message" could not find the main class. Program
Advertisements
 

 

 

DMCA.com