Java语言怎么从我的文档的目录里面读取最近生成的txt文件,并且将这个文件里面的数据插入另一个txt
**核心就这一点 获取txt文件按照创建时间排序 **
private Long getFileCreateTime(String filePath){
File file = new File(filePath);
try {
Path path= Paths.get(filePath);
BasicFileAttributeView basicview= Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS );
BasicFileAttributes attr = basicview.readAttributes();
return attr.creationTime().toMillis();
} catch (Exception e) {
e.printStackTrace();
return file.lastModified();
}
}