Reputation: 71
I am trying to get a list of files with no extension using org.apache.commons.io.FileUtils.listFiles()
like here
http://www.avajava.com/tutorials/lessons/how-do-i-get-all-files-with-certain-extensions-in-a-directory-including-subdirectories.html
package test;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.commons.io.FileUtils;
public class GetAllFilesInDirectoryBasedOnExtensions {
public static void main(String[] args) throws IOException {
File dir = new File("dir");
String[] extensions = new String[] { "txt", "jsp" };
System.out.println("Getting all .txt and .jsp files in " + dir.getCanonicalPath()
+ " including those in subdirectories");
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
for (File file : files) {
System.out.println("file: " + file.getCanonicalPath());
}
}
}
but I need a list of files with no extension. I've tried {".", ""}
but that didn't help. Is it possible at all?
Upvotes: 4
Views: 14048