The below code gives me the file path of the files in a directory that ends with "-path.mp4".But I need to get the file path of the files in a directory that doesn't end with "-path.mp4".
List<String> results = new ArrayList<String>();
File directory = new File(path);
FileFilter fileFilter = new WildcardFileFilter("*-path.mp4");
File[] files = directory.listFiles(fileFilter);
Arrays.sort(files, new Comparator<File>() {
public int compare(File f1, File f2) {
return Long.compare(f2.lastModified(), f1.lastModified());
}
});
for (File file : files) {
if (file.isFile()) {
results.add(file.getName());
}
}
return results;