| 29 | } |
| 30 | |
| 31 | public static void clean(String goal) { |
| 32 | try { |
| 33 | Files.walkFileTree(Paths.get(goal), new SimpleFileVisitor<>() { |
| 34 | @Override |
| 35 | public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { |
| 36 | Files.delete(file); |
| 37 | return FileVisitResult.CONTINUE; |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { |
| 42 | if (exc == null) { |
| 43 | Files.delete(dir); |
| 44 | } |
| 45 | return FileVisitResult.CONTINUE; |
| 46 | } |
| 47 | }); |
| 48 | } catch (Exception ignored) { |
| 49 | |
| 50 | } |
| 51 | } |
| 52 | } |