Created
June 1, 2016 12:25
-
-
Save baybatu/888f614e58b562a9ea0701e2450ca9b4 to your computer and use it in GitHub Desktop.
Process files by their last modified dates in Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'delete' is a process example | |
public void deleteOldFiles(File path) { | |
long startOfDay = new Date().clearTime().time | |
path.eachFile { file -> | |
if (file.lastModified() < startOfDay) { | |
file.delete() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment