List of utility methods to do Path Remove nio
boolean | removeLine(String path, String line, boolean commentAware) Removes this line from the specified file. boolean hasLine = fileHasLine(path, line, commentAware); if (hasLine) { String[] lines = getLines(path, true); if (hasLine) { String text = ""; for (int i = 0; i < lines.length; i++) { if (!lines[i].matches(line + (commentAware ? "(\\s*//.*)?" : ""))) { text += lines[i] + System.lineSeparator(); ... |
void | removeRecursive(Path path) Delete directory recursively. Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { ... |
void | removeRecursive(Path path) remove Recursive Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { if (exc == null) { Files.delete(dir); return FileVisitResult.CONTINUE; } else { throw exc; ... |
void | removeSymlink(Path softLinkLocation) remove Symlink try { BasicFileAttributes basicFileAttributes = getBasicFileAttributes(softLinkLocation); if (!basicFileAttributes.isSymbolicLink()) { throw new IOException("tried to delete a symlink which wasn't a symlink."); Files.delete(softLinkLocation); } catch (IOException e) { System.err.println(e); ... |
void | reportRemoveSymink(Path softLinkLocation) report Remove Symink reportRemoveSymink(softLinkLocation.toString()); |
LinkedHashMap | rm(final LinkedHashMap rm if (locations != null) { for (Path location : locations) { if (location != null && Files.exists(location)) { try { Files.walkFileTree(location, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { ... |