class FileHelper {

    static Collection<File> getFilesOlderThan(File filePath, Long age, Boolean recursive) {
        if (filePath == null || !filePath.exists()) {
            return new ArrayList<File>();
        }
        Iterator<File> files = null;

        if (recursive.booleanValue()) {
            files = FileUtils.iterateFiles(filePath, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
        } else {
            files = FileUtils.iterateFiles(filePath, TrueFileFilter.INSTANCE, null);
        }

        Collection<File> result = new ArrayList<File>();
        Date date = new Date();
        while (files.hasNext()) {
            File file = files.next();

            if (file.lastModified() < date.getTime() - age.longValue()) {
                result.add(file);
                log.trace(new StringBuilder("Added ").append(file.getPath()).append(" to \"old files list\".").toString());
            }
        }

        return result;
    }

}