@Test public void testGetFilesOlderThanWithRealFilePathAndNonRecursiveWithMaxAgeValue() { System.out.println("Test: " + "testGetFilesOlderThanWithRealFilePathAndNonRecursiveWithMaxAgeValue"); Collection<File> result = FileHelper.getFilesOlderThan(new File(this.tempDir), Long.MAX_VALUE, Boolean.FALSE); assertTrue(result.isEmpty()); }
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; }
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; } }
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; }  }
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; }  static byte[] base64Encode(final File input); static byte[] base64Encode(final byte[] input); static byte[] getByteArrayFromFile(File file); static boolean renameFile(final File fromFile, final String toFileName); static boolean copyFileToPath(final File inFile, final String outFilePath); static boolean copyFileToPath(final File inFile, final String outPath, boolean deleteOriginalFile); static Collection<File> wipeOldFiles(File directory, Long cutoffTime, boolean deleteDirectory); static boolean createDir(File directory); static boolean createDir(String directory); static boolean deleteDirRecursively(File directory); static boolean deleteDirRecursively(String directory); static boolean deleteFileQuietly(String filePath); static boolean deleteFileQuietly(File file); static boolean deleteFile(String filePath); static boolean deleteFile(File file); static boolean doesDirectoryOrFileExist(String filePath); static File findFile(String file, String rootPath); static List<String> getFileList(String filePath, boolean recursive); static List<String> getFileList(String filePath, String[] extensions, boolean recursive); static Collection<File> getFileCollection(String filePath, boolean recursive); static Collection<?> getFileCollection(String filePath, String[] extensions, boolean recursive); static String getSystemTemp(); static boolean zipDirectory(String inputDirectory, String absoluteFileName); static boolean unzipFile(String outputDirectory, File zipFile); static String createUserDirectory(String applicationUserSpaceDir); static boolean updateTimestamp(final String path, final boolean recursive); static Boolean validateShapeFile(final File shapeFile); static Boolean validateShapeZIP(final File shapeZip); }
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; }  static byte[] base64Encode(final File input); static byte[] base64Encode(final byte[] input); static byte[] getByteArrayFromFile(File file); static boolean renameFile(final File fromFile, final String toFileName); static boolean copyFileToPath(final File inFile, final String outFilePath); static boolean copyFileToPath(final File inFile, final String outPath, boolean deleteOriginalFile); static Collection<File> wipeOldFiles(File directory, Long cutoffTime, boolean deleteDirectory); static boolean createDir(File directory); static boolean createDir(String directory); static boolean deleteDirRecursively(File directory); static boolean deleteDirRecursively(String directory); static boolean deleteFileQuietly(String filePath); static boolean deleteFileQuietly(File file); static boolean deleteFile(String filePath); static boolean deleteFile(File file); static boolean doesDirectoryOrFileExist(String filePath); static File findFile(String file, String rootPath); static List<String> getFileList(String filePath, boolean recursive); static List<String> getFileList(String filePath, String[] extensions, boolean recursive); static Collection<File> getFileCollection(String filePath, boolean recursive); static Collection<?> getFileCollection(String filePath, String[] extensions, boolean recursive); static String getSystemTemp(); static boolean zipDirectory(String inputDirectory, String absoluteFileName); static boolean unzipFile(String outputDirectory, File zipFile); static String createUserDirectory(String applicationUserSpaceDir); static boolean updateTimestamp(final String path, final boolean recursive); static Boolean validateShapeFile(final File shapeFile); static Boolean validateShapeZIP(final File shapeZip);  }