Deletes the file, or the directory and its children. @return true if the file does not exist or has been deleted
()
| 305 | * @return {@code true} if the file does not exist or has been deleted |
| 306 | */ |
| 307 | public boolean delete() { |
| 308 | boolean ok = true; |
| 309 | if(file.exists()) { |
| 310 | if(isDir()) { |
| 311 | for(final IOFile ch : children()) ok &= ch.delete(); |
| 312 | } |
| 313 | try { |
| 314 | Files.delete(toPath()); |
| 315 | } catch(final IOException ex) { |
| 316 | Util.debug(ex); |
| 317 | return false; |
| 318 | } |
| 319 | } |
| 320 | return ok; |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * Renames a file to the specified path. The path must not exist yet. |