AgeFileFilter
only filters files before or after the cut off date-time instance.
Remember that the cutOffDate
parameter is the unix date-time in milliseconds
Will you know the exact date and time by the millisecond and have it saved in your property file?
If yes (unlikely), why don't you simply write your own FileFilter
? It is only a single method, and with Java 8 you can write it easily like this:
long cutOffDate = 1536584743813L;
FileFilter fileFilter = file -> file.lastModified() == cutOffDate;
I suspect that it is unlikely what you want though. Do you load just a date (without time) from your property file?
Then you probably want to get the date of the file from the last modified timestamp.
The following only accepts files that were modified today. Instead of today
you can have any LocalDate
loaded from your property file.
LocalDate today = LocalDate.now();
FileFilter fileFilter = file -> LocalDate.from(Instant.ofEpochMilli(file.lastModified())).isEqual(today);