code: public static String computeFileRelativeLocation( File rootDirectory, File subFile ) {
  
  		String rootPath = rootDirectory.getAbsolutePath();
  		String subPath = subFile.getAbsolutePath();
  		if(  ! subPath.startsWith( rootPath ))
  			throw new IllegalArgumentException( "The sub-file must be contained in the directory." );
  
  		if(  rootDirectory.equals( subFile ))
  			throw new IllegalArgumentException( "The sub-file must be different than the directory." );
  
  		return subPath.substring( rootPath.length() + 1 ).replace( '\\', '/' );
  	}
docs: Computes the relative location of a file with respect to a root directory.
  @param rootDirectory a directory
  @param subFile a file contained (directly or indirectly) in the directory
  @return a non-null string