code: public static String toFileId(Path p) {
      if (p.isRoot()) {
        return "";
      }
      final String format = "%s" + Path.SEPARATOR + "%s";
      if (p.getParent() != null && StringUtils.isEmpty(p.getParent().getName())) {
        return p.getName();
      }
      return String.format(format, toFileId(p.getParent()), p.getName());
    }
docs: org.apache.hadoop.fs.Path assumes that there separator in file system naming and "/" is the separator.
  When org.apache.hadoop.fs.Path sees "/" in path String, it splits into parent and name. As fileID is a random
  String determined by Google and it can contain "/" itself, this method check if parent and name is separated and
  restore "/" back to file ID.
  
  @param p
  @return