code: @Nonnull
    public static FileIOError deleteDir (@Nonnull final File aDir)
    {
      ValueEnforcer.notNull (aDir, "Directory");
  
      // Does the directory not exist?
      if (!FileHelper.existsDir (aDir))
        return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.DELETE_DIR, aDir);
  
      if (isExceptionOnDeleteRoot ())
      {
        // Check that we're not deleting the complete hard drive...
        if (aDir.getAbsoluteFile ().getParent () == null)
          throw new IllegalArgumentException ("Aren't we deleting the full drive: '" + aDir.getAbsolutePath () + "'");
      }
  
      // Is the parent directory writable?
      final File aParentDir = aDir.getParentFile ();
      if (aParentDir != null && !aParentDir.canWrite ())
        return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.DELETE_DIR, aDir);
  
      try
      {
        Files.delete (aDir.toPath ());
        return EFileIOErrorCode.NO_ERROR.getAsIOError (EFileIOOperation.DELETE_DIR, aDir);
      }
      catch (final NoSuchFileException ex)
      {
        return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.DELETE_DIR, aDir);
      }
      catch (final DirectoryNotEmptyException ex)
      {
        return EFileIOErrorCode.OPERATION_FAILED.getAsIOError (EFileIOOperation.DELETE_DIR, aDir);
      }
      catch (final IOException ex)
      {
        return EFileIOErrorCode.IO_ERROR.getAsIOError (EFileIOOperation.DELETE_DIR, aDir);
      }
      catch (final SecurityException ex)
      {
        return EFileIOErrorCode.getSecurityAsIOError (EFileIOOperation.DELETE_DIR, ex);
      }
    }
docs: Delete an existing directory. The directory needs to be empty before it can
  be deleted.
  
  @param aDir
  The directory to be deleted. May not be <code>null</code>.
  @return A non-<code>null</code> error code.