public T deleteTreeOpt() throws IOException { if (exists()) { deleteTree(); } return (T) this; }
/** * Moves this file or directory to dest. Throws an exception if this does not exist or if dest already exists. * This method is a default implementation with copy and delete, derived classes should override it with a native * implementation when available. * * @param overwrite false reports an error if the target already exists. true can be usued to implement atomic updates. * @return dest * @throws FileNotFoundException if this does not exist */ public Node move(Node dest, boolean overwrite) throws NodeNotFoundException, MoveException { try { if (!overwrite) { dest.checkNotExists(); } copy(dest); deleteTree(); } catch (FileNotFoundException e) { throw e; } catch (IOException e) { throw new MoveException(this, dest, "move failed", e); } return dest; }