code: public static String createEncodedName(File source) {
          String fileURI = source.toURI().toString();
          String userDirURI = new File(System.getProperty("user.dir")).toURI()
                  .toString();
          fileURI = fileURI.replace(userDirURI, "");
          String encodedName = fileURI.substring(fileURI.lastIndexOf(':') + 1)
                  .replace("%20", "-").replace('/', '_');
          return encodedName;
      }
docs: Creates a directory name from a file path.
  
  @param source
  A File reference.
  @return A String representing a legal directory name.