Here you can find the source of find(final File root, final String name)
Parameter | Description |
---|---|
root | a parameter |
name | a parameter |
public static File find(final File root, final String name)
//package com.java2s; /******************************************************************************* * Manchester Institute of Biotechnology * University of Manchester/* w w w . ja va 2s.co m*/ * Manchester M1 7ND * United Kingdom * * Copyright (C) 2013 University of Manchester * * This program is released under the Academic Free License ("AFL") v3.0. * (http://www.opensource.org/licenses/academic.php) *******************************************************************************/ import java.io.*; public class Main { /** * * @param root * @param name * @return File */ public static File find(final File root, final String name) { if (root.getName().equals(name)) { return root; } if (root.isDirectory()) { for (final File child : root.listFiles()) { final File result = find(child, name); if (result != null) { return result; } } } return null; } }