Here you can find the source of getNewFileList(String path, String mintime)
public static List getNewFileList(String path, String mintime) throws ParseException
//package com.java2s; //License from project: Apache License import java.io.File; import java.text.ParseException; import java.util.Date; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; public class Main { public static List getNewFileList(String path, String mintime) throws ParseException { List list = new ArrayList(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date d;//w w w . j av a 2 s . c om d = sdf.parse(mintime); List<String> filelist = getAllFileName(path); for (String file : filelist) { File f = new File(file); //Date filetime = new Date(f.lastModified()); Timestamp time = new Timestamp(f.lastModified()); //SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); //String dt = sdt.format(filetime); if (d.getTime() < time.getTime()) { /*//System.out.println(mintime + "======" + mintime); System.out.println("--------------------------------------"); System.out.println(file + "======" + time);*/ list.add(file); } } return list; } public static List<String> getAllFileName(String path) { File file = new File(path); File[] fileName = file.listFiles(); List<String> list = new ArrayList<>(); if (file.isDirectory()) { for (File string : fileName) if (new File(string.getPath()).isFile()) { System.out.println(string.getPath()); list.add(string.getPath()); } } else { System.out.println("it's a file."); //System.exit(1); } return list; } }