Code example for File

Methods: listFiles

0
    public static File[] listFilesWithExtension(File dir, String extension) {
        if (dir == null) {
            return null; 
        } 
        if (extension != null && extension.length() > 0) {
            return dir.listFiles(createExtensionFilenameFilter(extension));
        } else { 
            return dir.listFiles();
        } 
    } 
 
    /** 
     * Lists the filenames with the specified extension contained in the given directory. 
     * 
     * @see java.io.File#list() 
     * @see java.io.File#list(java.io.FilenameFilter) 
     */ 
    public static String[] listFilePathsWithExtension(File dir, String extension) {
        if (dir == null) {
            return null; 
Experience pair programming with AI  Get Codota for Java