Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void recursifDelete(File path) throws IOException
- {
- if(!path.exists())
- {
- throw new IOException("File not found '" + path.getAbsolutePath() + "'");
- }
- if(path.isDirectory())
- {
- File[] children = path.listFiles();
- for(int i = 0; children != null && i < children.length; i++)
- recursifDelete(children[i]);
- if(!path.delete())
- {
- throw new IOException("No delete path '" + path.getAbsolutePath() + "'");
- }
- }
- else if(!path.delete())
- {
- throw new IOException("No delete file '" + path.getAbsolutePath() + "'");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement