code: public boolean isParentAnEmptyDirectory(File file) {
          File parent = file.getParentFile();
  
          if (parent != null && parent.exists() && parent.isDirectory() && parent.list().length == 0) {
              return true;
          }
  
          return false;
      }
docs: Determine if the directory where the passed file resides is empty.
  
  @param file the folder to remove
  @return true if the parent folder is empty, false otherwise