MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / delTxtFiles

Method delTxtFiles

files/PathWatcher.java:13–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11public class PathWatcher {
12 static Path test = Paths.get("test");
13 static void delTxtFiles() {
14 try {
15 Files.walk(test)
16 .filter(f ->
17 f.toString().endsWith(".txt"))
18 .forEach(f -> {
19 try {
20 System.out.println("deleting " + f);
21 Files.delete(f);
22 } catch(IOException e) {
23 throw new RuntimeException(e);
24 }
25 });
26 } catch(IOException e) {
27 throw new RuntimeException(e);
28 }
29 }
30 public static void
31 main(String[] args) throws Exception {
32 Directories.refreshTestDir();

Callers 1

mainMethod · 0.95

Calls 2

walkMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected