Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { private static void cleanDir(File dir) { File[] files = dir.listFiles(); for (File file : files) { if (file.lastModified() + 1000 < System.currentTimeMillis()) { //more than a day old file.delete(); } } } }