public static boolean deleteRecursively(File file) {
    if (file.isDirectory()) {
      deleteContents(file);
    }
    // if I can delete directory then I know everything was deleted
    return file.delete();
  }
Deletes the file and if it's a directory deletes also any content in it

@param file a file or directory
@return true if the file/directory could be deleted
fbcore/src/main/java/com/facebook/common/file/FileTree.java