package Visual_DVM_2021.Passes.All; import Common.Global; import Common.Utils.Utils; import Visual_DVM_2021.Passes.Pass_2021; import java.io.File; import java.util.*; public class GetOldBugReports extends Pass_2021> { @Override protected boolean canStart(Object... args) throws Exception { target = new Vector<>(); return true; } @Override protected boolean needsAnimation() { return true; } @Override protected void body() throws Exception { File workspace = Global.visualiser.getWorkspace(); File[] files = workspace.listFiles(pathname -> pathname.isDirectory() && pathname.getName().toLowerCase().startsWith("bugreport_")); if (files != null) { //--- Calendar c = new GregorianCalendar(); c.setTimeInMillis(System.currentTimeMillis()); c.add(Calendar.MONTH, -2); Date date = c.getTime(); System.out.println(date); long border = date.getTime(); //-- for (File file: files){ ShowMessage2(file.getName()); long mdate = Utils.getNewestFileDate(file); if (mdate<=border){ target.add(file); } } } } }