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.ArrayList;
import java.util.List;

public class Main {
    static List<File> listFile = new ArrayList<File>();
    static String fileType;

    private static void searchDirSort(File dirFile) {
        File[] files = dirFile.listFiles();
        List<File> dirList = new ArrayList<File>();
        if (files != null) {
            for (File file : files) {
                if (file.isDirectory()) {
                    dirList.add(file);
                } else {
                    if (file.getName().toLowerCase().contains(fileType.toLowerCase())) {
                        listFile.add(file);
                    }
                }
            }
            for (File dir : dirList) {
                if (dir.getName().subSequence(0, 1).equals(".") || dir.getName().equals("Android")) {

                } else {
                    searchDirSort(dir);
                }
            }
        }
    }
}