1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package ch.hslu.exercises.sw11.ex4.findfile;
17
18 import java.io.File;
19 import java.util.Collections;
20 import java.util.concurrent.ExecutorService;
21 import java.util.concurrent.Executors;
22
23 import org.slf4j.LoggerFactory;
24 import org.slf4j.Logger;
25
26
27
28
29 public final class FindFile {
30
31 private FindFile() {
32 }
33
34 private static final Logger LOG = LoggerFactory.getLogger(FindFile.class);
35
36
37
38
39
40
41
42 public static void findFile(final String name, final File dir) {
43 final File[] list = dir.listFiles();
44 if (list != null) {
45 for (File file : list) {
46 if (file.isDirectory()) {
47 findFile(name, file);
48 } else if (name.equalsIgnoreCase(file.getName())) {
49 LOG.info(file.getParentFile().toString());
50 return;
51 }
52 }
53 }
54 }
55 }