private void maybeDeleteResidualDirectory(String partitionName) throws IOException {
    for (String unexpectedDir : unexpectedDirs) {
      String[] segments = unexpectedDir.split(File.separator);
      if (partitionName.equals(segments[segments.length - 1])) {
        logger.info("Deleting residual directory associated with store {}", partitionName);
        File dirToDelete = new File(unexpectedDir);
        try {
          Utils.deleteFileOrDirectory(dirToDelete);
        } catch (Exception e) {
          throw new IOException("Couldn't delete directory " + unexpectedDir, e);
        }
      }
    }
  }
Maybe delete the residual directory associated with removed replica.
@param partitionName name of replica that is already removed
ambry-store/src/main/java/com/github/ambry/store/StorageManager.java