Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import java.util.List;

public class Main {
    public static List<String> getFile(String path, Integer count, String fileEnd, List<String> result) {
        File f = new File(path);
        File[] files = f.listFiles();

        for (File s : files) {
            if (s.isDirectory()) {
                getFile(s.getAbsolutePath(), count, fileEnd, result);
            } else {
                if (s.getName().toLowerCase().endsWith(fileEnd.toLowerCase())) {
                    result.add(s.getAbsolutePath());
                }
            }
        }
        return result;
    }
}