Find the files that has been modified before run the program

Find the files that has been modified before run the program

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?

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.

Ads









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... 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 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
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
System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h' has been modified since the precompiled header
System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h' has been modified since the precompiled header  Hi, I am getting the following... been modified since the precompiled header You should delete the .pcm 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
Has anyone been killed by a robot?
Has anyone been killed by a robot?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Has... links so that I can learn the topic "Has anyone been killed by a robot?"
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
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
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
ModuleNotFoundError: No module named 'tox-run-before'
ModuleNotFoundError: No module named 'tox-run-before'  Hi, My... named 'tox-run-before' How to remove the ModuleNotFoundError: No module named 'tox-run-before' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tox-run-before'
ModuleNotFoundError: No module named 'tox-run-before'  Hi, My... named 'tox-run-before' How to remove the ModuleNotFoundError: No module named 'tox-run-before' error? Thanks   Hi, In your python
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
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
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
ModuleNotFoundError: No module named 'find-files'
ModuleNotFoundError: No module named 'find-files'  Hi, My Python... 'find-files' How to remove the ModuleNotFoundError: No module named 'find... have to install padas library. You can install find-files python
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 rmi program
how to run rmi program  how to run rmi program
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 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
TensorFlow 2.0 session run
TensorFlow 2.0 session run - removed In TensorFlow 2.0 session has been... code. This has been removed as we have eager execution is enabled by default... executed in the Google Colab environment: In TensorFlow 2.0 Session has been
TensorFlow 2.0 session run
TensorFlow 2.0 session run - removed In TensorFlow 2.0 session has been... code. This has been removed as we have eager execution is enabled by default... executed in the Google Colab environment: In TensorFlow 2.0 Session has been
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 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 JSP program inEclipse?
How to run JSP program inEclipse?  Hi, I am learning JSP. I want to run JSP in Eclipse. How to run JSP program inEclipse? Thanks   Hi, Its easy to run JSP from the Eclipse. You have to make a dynamic web application
ModuleNotFoundError: No module named 'find-duplicate-files'
ModuleNotFoundError: No module named 'find-duplicate-files'  Hi...: No module named 'find-duplicate-files' How to remove the ModuleNotFoundError: No module named 'find-duplicate-files' error? Thanks   Hi
java program run on thml page?
java program run on thml page?  how to run java program on html page using text area
run command for all files in directory bash
run command for all files in directory bash  Hi, I have a directory with many many files. I want to run for all files in the directory in Linux. How to do this with bash script? How to run command for all files in directory

Ads