All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zhangyue.we.anoprocesser.xml.Utils Maven / Gradle / Ivy

The newest version!
package com.zhangyue.we.anoprocesser.xml;

import java.io.File;

public class Utils {

    public static File findFileRecursive(File dir, String fileName) {
        if (dir == null) {
            return null;
        }
        if (dir.isFile()) {
            if (dir.getName().equals(fileName)) {
                return dir;
            } else {
                return null;
            }
        }

        File[] files = dir.listFiles();
        if (files == null || files.length == 0) {
            return null;
        }
        for (File f : files) {
            if (f.isFile()) {
                if (f.getName().equals(fileName)) {
                    return f;
                }
            } else {
                return findFileRecursive(f, fileName);
            }
        }
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy