()
| 11 | public 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(); |