public static String getRelativePath(String path, String backupDirCanonicalPath) throws MalformedURLException
   {
      URL urlPath = new URL(resolveFileURL("file:" + path));
      URL urlBackupDir = new URL(resolveFileURL("file:" + backupDirCanonicalPath));

      return urlPath.toString().replace(urlBackupDir.toString() + "/", "");
   }
public static String getRelativePath ( String path , String backupDirCanonicalPath ) throws MalformedURLException { URL urlPath = new URL ( resolveFileURL ( "file:" + path ) ) ; URL urlBackupDir = new URL ( resolveFileURL ( "file:" + backupDirCanonicalPath ) ) ; return urlPath . toString ( ) . replace ( urlBackupDir . toString ( ) + "/" , "" ) ; }
Will be returned relative path {name}/{name}.xml for all OS.

@param path
String, path to
@param backupDirCanonicalPath
String, path to backup dir
@return String
Will be returned relative path {name}/{name}.xml for all OS
@throws MalformedURLException