package com.lyubenblagoev.postfixrest;

import java.io.File;

import org.assertj.core.util.Files;

public final class FileUtils {
	
	private FileUtils() {
		// Prevent class instantiation
	}

	public static boolean renameFolder(File parentFolder, String oldName, String newName) {
		File oldFolder = new File(parentFolder, oldName);
		File newFolder = new File(parentFolder, newName);
		return oldFolder.renameTo(newFolder);
	}
	
	public static void deleteFolder(File parentFolder, String name) {
		File folder = new File(parentFolder, name);
		Files.delete(folder);
	}

}

@@ -58,76 +58,287 @@
 le;%0A
-%0A
 import 
-org.assertj.core.util.Files;%0A%0Apublic final class FileUtils %7B
+java.io.IOException;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Apublic final class FileUtils %7B%0A%09%0A%09private static final Logger log = LoggerFactory.getLogger(FileUtils.class);
 %0A%09%0A%09
@@ -415,15 +415,12 @@
 tic 
-boolean
+void
  ren
@@ -488,46 +488,89 @@
 %7B%0A%09%09
-File oldFolder = new File
+String parentPath = parentFolder.getPath();%0A%09%09Path oldPath = Paths.get
 (parent
-Folder
+Path
 , ol
@@ -583,46 +583,152 @@
 ;%0A%09%09
-File newFolder = new File
+if (!Files.exists(oldPath)) %7B%0A%09%09%09log.info(%22The path specified doesn't exist: %7B%7D%22, oldPath);%0A%09%09%09return;%0A%09%09%7D%0A%09%09Path newPath = Paths.get
 (parent
-Folder
+Path
 , ne
@@ -741,45 +741,139 @@
 ;%0A%09%09
-return oldFolder.renameTo(newFolder);
+try %7B%0A%09%09%09Files.move(oldPath, newPath);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09log.error(%22Failed to rename %7B%7D to %7B%7D%22, oldName, newName);%0A%09%09%7D
 %0A%09%7D%0A
@@ -947,30 +947,29 @@
 %7B%0A%09%09
-File folder = new File
+Path path = Paths.get
 (par
@@ -977,16 +977,26 @@
 ntFolder
+.getPath()
 , name);
@@ -996,16 +996,25 @@
  name);%0A
+%09%09try %7B%0A%09
 %09%09Files.
@@ -1024,16 +1024,89 @@
 ete(
-folder);
+path);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09log.error(%22Failed to delete %7B%7D%22, path);%0A%09%09%7D
 %0A%09%7D%0A

Use java.nio.files.Files to rename and delete folders