Here you can find the source of deletePath(Path path)
public static void deletePath(Path path)
//package com.java2s; //License from project: Apache License import java.io.File; import java.nio.file.Path; public class Main { public static void deletePath(Path path) { if (path == null) { return; }// ww w . j a v a 2s . com File file = path.toFile(); if (file.isDirectory()) { for (File item : file.listFiles()) { deletePath(item.toPath()); } } deleteFile(file); } public static void deleteFile(File file) { if (file == null || !file.exists()) { return; } file.delete(); } }